Mercurial > xib
comparison bridge.py @ 86:bfa32b017fc9
First hack at an error notification system
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 06 Sep 2009 15:34:49 +0200 |
parents | dfa030c141f1 |
children | c71861491968 |
comparison
equal
deleted
inserted
replaced
85:dfa030c141f1 | 86:bfa32b017fc9 |
---|---|
99 raise Exception('[Error] "'+self.bot.nickname+'" got "nicknametoolong" on bridge "'+str(self)+'", limit seems to be '+str(arguments[0])) | 99 raise Exception('[Error] "'+self.bot.nickname+'" got "nicknametoolong" on bridge "'+str(self)+'", limit seems to be '+str(arguments[0])) |
100 else: | 100 else: |
101 raise Exception('[Error] unknown error for "'+self.bot.nickname+'" on bridge "'+str(self)+'", limit seems to be '+str(arguments[0])) | 101 raise Exception('[Error] unknown error for "'+self.bot.nickname+'" on bridge "'+str(self)+'", limit seems to be '+str(arguments[0])) |
102 except: | 102 except: |
103 traceback.print_exc() | 103 traceback.print_exc() |
104 self.bot.error('[Error] failed to connect to the IRC chan of bridge "'+str(self)+'", removing bridge') | 104 self.bot.error('[Error] failed to connect to the IRC chan of bridge "'+str(self)+'", removing bridge', send_to_admins=True) |
105 self.bot.removeBridge(self) | 105 self.bot.removeBridge(self) |
106 | 106 |
107 | 107 |
108 def _xmpp_join_callback(self, errors): | 108 def _xmpp_join_callback(self, errors): |
109 """Called by muc._xmpp_presence_handler""" | 109 """Called by muc._xmpp_presence_handler""" |
119 for error in errors: | 119 for error in errors: |
120 try: | 120 try: |
121 raise error | 121 raise error |
122 except: | 122 except: |
123 traceback.print_exc() | 123 traceback.print_exc() |
124 self.bot.error('[Error] failed to connect to the XMPP room of bridge "'+str(self)+'", removing bridge') | 124 self.bot.error('[Error] failed to connect to the XMPP room of bridge "'+str(self)+'", removing bridge', send_to_admins=True) |
125 self.bot.removeBridge(self) | 125 self.bot.removeBridge(self) |
126 | 126 |
127 | 127 |
128 def addParticipant(self, from_protocol, nickname): | 128 def addParticipant(self, from_protocol, nickname): |
129 """Add a participant to the bridge.""" | 129 """Add a participant to the bridge.""" |
235 self.participants.remove(p) | 235 self.participants.remove(p) |
236 p.leave(leave_message) | 236 p.leave(leave_message) |
237 del p | 237 del p |
238 self.lock.release() | 238 self.lock.release() |
239 if left_protocol == 'xmpp': | 239 if left_protocol == 'xmpp': |
240 i = len(self.get_participants_nicknames_list(protocols=['xmpp'])) | 240 xmpp_participants_nicknames = self.get_participants_nicknames_list(protocols=['xmpp']) |
241 if self.irc_connections_limit != -1 and self.irc_connections_limit > i: | 241 if self.irc_connections_limit != -1 and self.irc_connections_limit > len(xmpp_participants_nicknames): |
242 self.switchFromLimitedToNormalMode() | 242 self.switchFromLimitedToNormalMode() |
243 if self.mode != 'normal': | 243 if self.mode != 'normal': |
244 xmpp_participants_nicknames = self.get_participants_nicknames_list(protocols=['xmpp']) | |
245 self.say('[Info] Participants on XMPP: '+' '.join(xmpp_participants_nicknames), on_xmpp=False) | 244 self.say('[Info] Participants on XMPP: '+' '.join(xmpp_participants_nicknames), on_xmpp=False) |
246 elif left_protocol == 'irc': | 245 elif left_protocol == 'irc': |
247 if self.mode == 'minimal': | 246 if self.mode == 'minimal': |
248 irc_participants_nicknames = self.get_participants_nicknames_list(protocols=['irc']) | 247 irc_participants_nicknames = self.get_participants_nicknames_list(protocols=['irc']) |
249 self.say('[Info] Participants on IRC: '+' '.join(irc_participants_nicknames), on_irc=False) | 248 self.say('[Info] Participants on IRC: '+' '.join(irc_participants_nicknames), on_irc=False) |