# HG changeset patch # User Charly COSTE # Date 1258727407 -3600 # Node ID 29d3b85c6286864dcb32601a91905b78be318cbd # Parent 6289ac5a2db73406e185ce79d8f8ca143b13a04a Minor fixes/improvements Signed-off-by: Charly COSTE diff --git a/bot.py b/bot.py --- a/bot.py +++ b/bot.py @@ -83,10 +83,8 @@ class bot(Thread): try: if len(self.xmpp_connections) == 1: sleep(0.5) # avoid bot connection being locked all the time - j = 0 - for c in self.xmpp_connections.itervalues(): + for j, c in enumerate(self.xmpp_connections.itervalues()): i += 1 - j += 1 if hasattr(c, 'lock'): c.lock.acquire() if i == j: @@ -103,12 +101,14 @@ class bot(Thread): pass except (xml.parsers.expat.ExpatError, xmpp.protocol.XMLNotWellFormed): self.error('=> Debug: invalid stanza', debug=True) + self.reopen_xmpp_connection(c) unlock = True except xmpp.Conflict: + self.error('=> Debug: conflict', debug=True) self.reopen_xmpp_connection(c) unlock = True except: - error = '[Error] Unkonwn exception on XMPP thread:\n' + error = '[Error] Unknown exception on XMPP thread:\n' error += traceback.format_exc() self.error(error, send_to_admins=True) unlock = True diff --git a/bridge.py b/bridge.py --- a/bridge.py +++ b/bridge.py @@ -86,7 +86,7 @@ class bridge: self.say('[Notice] bridge "'+str(self)+'" is running in '+self.mode+' mode', on_xmpp=False) else: self.mode = None - if self.muc.connected == True: + if self.xmpp_room.connected == True: self.say('[Error] failed to connect to the IRC chan, leaving ...', on_irc=False) try: if error == 'nicknameinuse':