# HG changeset patch # User Charly COSTE # Date 1251297378 -7200 # Node ID 5aabf124c78d1620a33467a761578023a3ead139 # Parent 2737ed5b90036de0cecee79a49ace2b5fe4edf7a Fixed XMPP connection closing and the XMPP loop Signed-off-by: Charly COSTE diff --git a/bot.py b/bot.py --- a/bot.py +++ b/bot.py @@ -79,10 +79,9 @@ class bot(Thread): for c in self.xmpp_connections.itervalues(): if hasattr(c, 'lock'): c.lock.acquire() - if c in self.xmpp_connections.itervalues(): - if hasattr(c, 'Process'): - c.Process(0.01) - c.lock.release() + if hasattr(c, 'Process'): + c.Process(0.01) + c.lock.release() except RuntimeError: pass except (xml.parsers.expat.ExpatError, xmpp.protocol.XMLNotWellFormed): @@ -465,6 +464,7 @@ class bot(Thread): if c.used_by < 1: self.error('===> Debug: closing XMPP connection for "'+nickname+'"', debug=True) self.xmpp_connections.pop(nickname) + c.send(xmpp.protocol.Presence(typ='unavailable')) c.lock.release() del c else: @@ -503,4 +503,4 @@ class bot(Thread): def __del__(self): for bridge in self.bridges: - self.removeBridge(bridge) \ No newline at end of file + self.removeBridge(bridge)