Index: trunk/extensions/XMLRC/bridge/udp2xmpp.py |
— | — | @@ -114,10 +114,14 @@ |
115 | 115 | f = factories[ t ] |
116 | 116 | channel = f( x ) |
117 | 117 | |
| 118 | + self.add_channel( wiki, channel ) |
| 119 | + |
| 120 | + self.join_channels() |
| 121 | + |
| 122 | + def join_channels( self ): |
| 123 | + for name, channel in self.channels.items(): |
118 | 124 | channel.join() #FIXME: error detection / recovery! |
119 | 125 | |
120 | | - self.add_channel( wiki, channel ) |
121 | | - |
122 | 126 | def broadcast_message( self, message, xml = None ): |
123 | 127 | targets = self.get_all_channels() |
124 | 128 | |
— | — | @@ -244,7 +248,6 @@ |
245 | 249 | |
246 | 250 | if len(params) > 0 or pagename is None: |
247 | 251 | u = self.wiki_info.get_wiki_script_url( wikiid ) |
248 | | - print "script url for %s: %s" % (wikiid, u) |
249 | 252 | if not u: return False |
250 | 253 | |
251 | 254 | if not pagename is None: |
— | — | @@ -257,7 +260,6 @@ |
258 | 261 | return u + "?" + urllib.urlencode( params ) |
259 | 262 | else: |
260 | 263 | u = self.wiki_info.get_wiki_page_url( wikiid ) |
261 | | - print "page url for %s: %s" % (wikiid, u) |
262 | 264 | if not u: return False |
263 | 265 | |
264 | 266 | return u.replace( '$1', urllib.quote( pagename ) ) |
— | — | @@ -376,9 +378,6 @@ |
377 | 379 | elif message.getBody(): |
378 | 380 | self.debug("discarding %s message from <%s>: %s" % (message.getType(), message.getFrom(), message.getBody().strip() )) |
379 | 381 | |
380 | | - def register_handlers(self): |
381 | | - self.jabber.RegisterHandler( 'message', self.process_message ) |
382 | | - |
383 | 382 | def guess_local_resource(self): |
384 | 383 | resource = "%s-%d" % ( socket.gethostname(), os.getpid() ) |
385 | 384 | |
— | — | @@ -409,7 +408,7 @@ |
410 | 409 | |
411 | 410 | self.debug('authenticated using %s as %s' % ( auth, jid ) ) |
412 | 411 | |
413 | | - self.register_handlers() |
| 412 | + self.jabber.RegisterHandler( 'message', self.process_message ) |
414 | 413 | |
415 | 414 | self.jid = jid; |
416 | 415 | self.info( 'connected as %s' % ( jid ) ) |
— | — | @@ -422,6 +421,8 @@ |
423 | 422 | self.jabber.sendInitPresence(self) |
424 | 423 | self.roster = self.jabber.getRoster() |
425 | 424 | |
| 425 | + self.relay.join_channels() |
| 426 | + |
426 | 427 | def get_socket( self ): |
427 | 428 | return self.jabber.Connection._sock |
428 | 429 | |
Index: trunk/extensions/XMLRC/bridge/udp2xmpp.ini.sample |
— | — | @@ -21,6 +21,6 @@ |
22 | 22 | [XMPP] |
23 | 23 | # NOTE: please put your XMPP login info |
24 | 24 | # WARNING: make sure this file is not readable from the web! |
25 | | -jid: mediawiki@yourhost.jabber.com |
| 25 | +jid: mediawiki@jabber.yourhost.com |
26 | 26 | password: snoopy64 |
27 | 27 | # message-encoding: utf-8 |
\ No newline at end of file |