comparison bridge.py @ 268:7602a0898d19

catch irclib.UnknownChannel in Bridge.stop and Bridge.soft_restart Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Tue, 23 Mar 2010 00:42:36 +0100
parents f861a7038ad3
children abef394fded5
comparison
equal deleted inserted replaced
267:f861a7038ad3 268:7602a0898d19
406 if log: 406 if log:
407 self.bot.error(-1, message+' '+str(self), send_to_admins=True) 407 self.bot.error(-1, message+' '+str(self), send_to_admins=True)
408 408
409 # Leave 409 # Leave
410 if isinstance(self.irc_connection, irclib.ServerConnection) and isinstance(self.xmpp_room, xmpp.muc): 410 if isinstance(self.irc_connection, irclib.ServerConnection) and isinstance(self.xmpp_room, xmpp.muc):
411 self.irc_connection.part(self.irc_room, message=message) 411 try:
412 self.irc_connection.part(self.irc_room, message=message)
413 except irclib.UnknownChannel:
414 pass
412 self.xmpp_room.leave(message=message) 415 self.xmpp_room.leave(message=message)
413 else: 416 else:
414 self.stop() 417 self.stop()
415 self.init2() 418 self.init2()
416 return 419 return
430 if isinstance(self.irc_connection, irclib.ServerConnection): 433 if isinstance(self.irc_connection, irclib.ServerConnection):
431 self.irc_connection.used_by -= 1 434 self.irc_connection.used_by -= 1
432 if self.irc_connection.used_by < 1: 435 if self.irc_connection.used_by < 1:
433 self.irc_connection.close(message) 436 self.irc_connection.close(message)
434 else: 437 else:
435 self.irc_connection.part(self.irc_room, message=message) 438 try:
439 self.irc_connection.part(self.irc_room, message=message)
440 except irclib.UnknownChannel:
441 pass
436 self.irc_connection = None 442 self.irc_connection = None
437 443
438 # Leave the MUC 444 # Leave the MUC
439 if isinstance(self.xmpp_room, xmpp.muc): 445 if isinstance(self.xmpp_room, xmpp.muc):
440 self.xmpp_room.leave(message=message) 446 self.xmpp_room.leave(message=message)