Mercurial > xib
comparison bot.py @ 37:7e500d4064fb
Cosmetics.
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 23 Aug 2009 13:17:05 +0200 |
parents | ebf516b2e5c9 |
children | 3b06450d60cd |
comparison
equal
deleted
inserted
replaced
36:e7766a49b199 | 37:7e500d4064fb |
---|---|
216 | 216 |
217 try: | 217 try: |
218 participant_ = bridge.getParticipant(resource) | 218 participant_ = bridge.getParticipant(resource) |
219 except NoSuchParticipantException: | 219 except NoSuchParticipantException: |
220 if resource != self.nickname: | 220 if resource != self.nickname: |
221 self.error('=> Debug: NoSuchParticipantException "'+resource+'", WTF ?', debug=True) | 221 self.error('=> Debug: NoSuchParticipantException "'+resource+'" on "'+str(bridge)+'", WTF ?', debug=True) |
222 return | 222 return |
223 | 223 |
224 participant_.sayOnIRC(message.getBody()) | 224 participant_.sayOnIRC(message.getBody()) |
225 return | |
225 | 226 |
226 else: | 227 else: |
227 self.error('==> Debug: Received XMPP message of unknown type "'+message.getType()+'".', debug=True) | 228 self.error('==> Debug: Received XMPP message of unknown type "'+message.getType()+'".', debug=True) |
228 self.error(message.__str__(fancy=1), debug=True) | 229 self.error(message.__str__(fancy=1), debug=True) |
229 | 230 |
442 | 443 |
443 | 444 |
444 def close_xmpp_connection(self, nickname): | 445 def close_xmpp_connection(self, nickname): |
445 if not self.xmpp_connections.has_key(nickname): | 446 if not self.xmpp_connections.has_key(nickname): |
446 return | 447 return |
447 self.xmpp_connections[nickname].used_by -= 1 | 448 c = self.xmpp_connections[nickname] |
448 if self.xmpp_connections[nickname].used_by < 1: | 449 c.used_by -= 1 |
450 if c.used_by < 1: | |
449 self.error('===> Debug: closing XMPP connection for "'+nickname+'"', debug=True) | 451 self.error('===> Debug: closing XMPP connection for "'+nickname+'"', debug=True) |
450 del self.xmpp_connections[nickname] | 452 self.xmpp_connections.pop(nickname) |
453 del c | |
451 else: | 454 else: |
452 self.error('===> Debug: XMPP connection for "'+nickname+'" is now used by '+str(self.xmpp_connections[nickname].used_by)+' bridges', debug=True) | 455 self.error('===> Debug: XMPP connection for "'+nickname+'" is now used by '+str(c.used_by)+' bridges', debug=True) |
453 | 456 |
454 | 457 |
455 def removeBridge(self, bridge): | 458 def removeBridge(self, bridge): |
456 self.bridges.remove(bridge) | 459 self.bridges.remove(bridge) |
457 del bridge | 460 del bridge |