comparison participant.py @ 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
comparison
equal deleted inserted replaced
64:8fc496eaa17b 65:75604669fcd9
16 16
17 17
18 import muc 18 import muc
19 xmpp = muc.xmpp 19 xmpp = muc.xmpp
20 del muc 20 del muc
21 import irclib 21 from irclib import ServerNotConnectedError
22 from encoding import * 22 from encoding import *
23 from threading import Thread 23 from threading import Thread
24 from time import sleep 24 from time import sleep
25 25
26 26
147 147
148 148
149 def sayOnIRC(self, message): 149 def sayOnIRC(self, message):
150 try: 150 try:
151 if self.irc_connection != None: 151 if self.irc_connection != None:
152 self.irc_connection.privmsg(self.bridge.irc_room, message) 152 try:
153 self.irc_connection.privmsg(self.bridge.irc_room, message)
154 except ServerNotConnectedError:
155 self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message)
153 elif self.xmpp_c == None: 156 elif self.xmpp_c == None:
154 self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message) 157 self.bridge.irc_connection.privmsg(self.bridge.irc_room, '<'+self.nickname+'> '+message)
155 except EncodingException: 158 except EncodingException:
156 self.bridge.say('[Warning] "'+self.nickname+'" is sending messages using an unknown encoding') 159 self.bridge.say('[Warning] "'+self.nickname+'" is sending messages using an unknown encoding')
157 160