Mercurial > xib
diff bridge.py @ 100:6289ac5a2db7
Reconnect when a connection is closed
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 04 Oct 2009 23:47:09 +0200 |
parents | c71861491968 |
children | 29d3b85c6286 |
line wrap: on
line diff
--- a/bridge.py +++ b/bridge.py @@ -212,7 +212,15 @@ class bridge: elif left_protocol == 'irc': p.createDuplicateOnIRC() else: - was_on_both = False + if left_protocol == 'xmpp': + was_on_both = False + elif left_protocol == 'irc': + try: + p.irc_connection.join(self.irc_room) + except: + p._close_irc_connection() + p.createDuplicateOnIRC() + return elif p.protocol == 'irc': if p.xmpp_c == 'both': @@ -223,7 +231,12 @@ class bridge: elif left_protocol == 'xmpp': p.createDuplicateOnXMPP() else: - was_on_both = False + if left_protocol == 'irc': + was_on_both = False + elif left_protocol == 'xmpp': + if isinstance(p.xmpp_c, xmpp.client.Client): + self.bot.reopen_xmpp_connection(p.xmpp_c) + return else: raise Exception('[Internal Error] bad protocol')