r70936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70935‎ | r70936 | r70937 >
Date:10:05, 12 August 2010
Author:daniel
Status:deferred
Tags:
Comment:
re-join after re-connect
Modified paths:
  • /trunk/extensions/XMLRC/bridge/udp2xmpp.ini.sample (modified) (history)
  • /trunk/extensions/XMLRC/bridge/udp2xmpp.py (modified) (history)

Diff [purge]

Index: trunk/extensions/XMLRC/bridge/udp2xmpp.py
@@ -114,10 +114,14 @@
115115 f = factories[ t ]
116116 channel = f( x )
117117
 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():
118124 channel.join() #FIXME: error detection / recovery!
119125
120 - self.add_channel( wiki, channel )
121 -
122126 def broadcast_message( self, message, xml = None ):
123127 targets = self.get_all_channels()
124128
@@ -244,7 +248,6 @@
245249
246250 if len(params) > 0 or pagename is None:
247251 u = self.wiki_info.get_wiki_script_url( wikiid )
248 - print "script url for %s: %s" % (wikiid, u)
249252 if not u: return False
250253
251254 if not pagename is None:
@@ -257,7 +260,6 @@
258261 return u + "?" + urllib.urlencode( params )
259262 else:
260263 u = self.wiki_info.get_wiki_page_url( wikiid )
261 - print "page url for %s: %s" % (wikiid, u)
262264 if not u: return False
263265
264266 return u.replace( '$1', urllib.quote( pagename ) )
@@ -376,9 +378,6 @@
377379 elif message.getBody():
378380 self.debug("discarding %s message from <%s>: %s" % (message.getType(), message.getFrom(), message.getBody().strip() ))
379381
380 - def register_handlers(self):
381 - self.jabber.RegisterHandler( 'message', self.process_message )
382 -
383382 def guess_local_resource(self):
384383 resource = "%s-%d" % ( socket.gethostname(), os.getpid() )
385384
@@ -409,7 +408,7 @@
410409
411410 self.debug('authenticated using %s as %s' % ( auth, jid ) )
412411
413 - self.register_handlers()
 412+ self.jabber.RegisterHandler( 'message', self.process_message )
414413
415414 self.jid = jid;
416415 self.info( 'connected as %s' % ( jid ) )
@@ -422,6 +421,8 @@
423422 self.jabber.sendInitPresence(self)
424423 self.roster = self.jabber.getRoster()
425424
 425+ self.relay.join_channels()
 426+
426427 def get_socket( self ):
427428 return self.jabber.Connection._sock
428429
Index: trunk/extensions/XMLRC/bridge/udp2xmpp.ini.sample
@@ -21,6 +21,6 @@
2222 [XMPP]
2323 # NOTE: please put your XMPP login info
2424 # WARNING: make sure this file is not readable from the web!
25 -jid: mediawiki@yourhost.jabber.com
 25+jid: mediawiki@jabber.yourhost.com
2626 password: snoopy64
2727 # message-encoding: utf-8
\ No newline at end of file

Status & tagging log