Mercurial > xib
comparison participant.py @ 247:303e571bc104
catch ServerNotConnectedError in Participant.say_on_irc_to
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Mon, 08 Mar 2010 18:47:07 +0100 |
parents | cf4f00441628 |
children | 234e8ca6a10c |
comparison
equal
deleted
inserted
replaced
246:5e65f52be453 | 247:303e571bc104 |
---|---|
303 if bot_say: | 303 if bot_say: |
304 self.bridge.say_on_behalf(self.nickname, message, 'irc', action=action) | 304 self.bridge.say_on_behalf(self.nickname, message, 'irc', action=action) |
305 | 305 |
306 | 306 |
307 def say_on_irc_to(self, to, message): | 307 def say_on_irc_to(self, to, message): |
308 if isinstance(self.irc_connection, ServerConnection): | 308 error = False |
309 self.irc_connection.privmsg(to, message) | 309 if isinstance(self.irc_connection, ServerConnection): |
310 try: | |
311 self.irc_connection.privmsg(to, message) | |
312 except ServerNotConnectedError: | |
313 self.irc_connection.connect() | |
314 error = True | |
310 elif not isinstance(self.xmpp_c, xmpp.client.Client): | 315 elif not isinstance(self.xmpp_c, xmpp.client.Client): |
316 error = True | |
317 | |
318 if error: | |
311 if self.bridge.mode not in ['normal', 'bypass']: | 319 if self.bridge.mode not in ['normal', 'bypass']: |
312 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') | 320 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but cross-protocol private messages are disabled in '+self.bridge.mode+' mode.') |
313 else: | 321 else: |
314 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.') | 322 self.bridge.get_participant(to).say_on_xmpp_to(self.nickname, 'XIB error: Sorry but you cannot send cross-protocol private messages because I don\'t have an IRC duplicate with your nickname.') |
315 | 323 |