Mercurial > xib
comparison 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 |
comparison
equal
deleted
inserted
replaced
99:5390e9abfa44 | 100:6289ac5a2db7 |
---|---|
210 p.protocol = 'irc' | 210 p.protocol = 'irc' |
211 p.createDuplicateOnXMPP() | 211 p.createDuplicateOnXMPP() |
212 elif left_protocol == 'irc': | 212 elif left_protocol == 'irc': |
213 p.createDuplicateOnIRC() | 213 p.createDuplicateOnIRC() |
214 else: | 214 else: |
215 was_on_both = False | 215 if left_protocol == 'xmpp': |
216 was_on_both = False | |
217 elif left_protocol == 'irc': | |
218 try: | |
219 p.irc_connection.join(self.irc_room) | |
220 except: | |
221 p._close_irc_connection() | |
222 p.createDuplicateOnIRC() | |
223 return | |
216 | 224 |
217 elif p.protocol == 'irc': | 225 elif p.protocol == 'irc': |
218 if p.xmpp_c == 'both': | 226 if p.xmpp_c == 'both': |
219 was_on_both = True | 227 was_on_both = True |
220 if left_protocol == 'irc': | 228 if left_protocol == 'irc': |
221 p.protocol = 'xmpp' | 229 p.protocol = 'xmpp' |
222 p.createDuplicateOnIRC() | 230 p.createDuplicateOnIRC() |
223 elif left_protocol == 'xmpp': | 231 elif left_protocol == 'xmpp': |
224 p.createDuplicateOnXMPP() | 232 p.createDuplicateOnXMPP() |
225 else: | 233 else: |
226 was_on_both = False | 234 if left_protocol == 'irc': |
235 was_on_both = False | |
236 elif left_protocol == 'xmpp': | |
237 if isinstance(p.xmpp_c, xmpp.client.Client): | |
238 self.bot.reopen_xmpp_connection(p.xmpp_c) | |
239 return | |
227 | 240 |
228 else: | 241 else: |
229 raise Exception('[Internal Error] bad protocol') | 242 raise Exception('[Internal Error] bad protocol') |
230 | 243 |
231 if was_on_both == True: | 244 if was_on_both == True: |