# HG changeset patch # User Charly COSTE # Date 1251630300 -7200 # Node ID 75604669fcd93ae636c7387234b3b645218dacde # Parent 8fc496eaa17b3edbbc46a415309c16bd28a9eff0 Some fault tolerance Signed-off-by: Charly COSTE diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -192,7 +192,11 @@ class IRC: if s == c._get_socket(): c.lock.acquire() if hasattr(c, 'socket'): - c.process_data() + try: + c.process_data() + except: + self.error('[Error] Unkonwn exception on IRC thread:') + traceback.print_exc() c.lock.release() def process_timeout(self): diff --git a/participant.py b/participant.py --- a/participant.py +++ b/participant.py @@ -18,7 +18,7 @@ import muc xmpp = muc.xmpp del muc -import irclib +from irclib import ServerNotConnectedError from encoding import * from threading import Thread from time import sleep @@ -149,7 +149,10 @@ class participant: def sayOnIRC(self, message): try: if self.irc_connection != None: - self.irc_connection.privmsg(self.bridge.irc_room, message) + try: + self.irc_connection.privmsg(self.bridge.irc_room, message) + except ServerNotConnectedError: + self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message) elif self.xmpp_c == None: self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message) except EncodingException: