Mercurial > xib
diff bot.py @ 52:5aabf124c78d
Fixed XMPP connection closing and the XMPP loop
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Wed, 26 Aug 2009 16:36:18 +0200 |
parents | 2737ed5b9003 |
children | a2258a705a17 |
line wrap: on
line diff
--- 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)