Mercurial > xib
changeset 65:75604669fcd9
Some fault tolerance
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 30 Aug 2009 13:05:00 +0200 |
parents | 8fc496eaa17b |
children | 91b98275f2eb |
files | irclib.py participant.py |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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: