comparison bridge.py @ 109:970a6b4ac6ce

Minor fixes Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sun, 22 Nov 2009 11:40:45 +0100
parents d8acff763731
children 59401ac0f47a
comparison
equal deleted inserted replaced
108:dff9746aa508 109:970a6b4ac6ce
150 if isinstance(p.muc, xmpp.muc): 150 if isinstance(p.muc, xmpp.muc):
151 p.muc.leave('') 151 p.muc.leave('')
152 self.bot.close_xmpp_connection(p.nickname) 152 self.bot.close_xmpp_connection(p.nickname)
153 if p.xmpp_c != 'both': 153 if p.xmpp_c != 'both':
154 p.xmpp_c = 'both' 154 p.xmpp_c = 'both'
155 return 155 return p
156 except NoSuchParticipantException: 156 except NoSuchParticipantException:
157 pass 157 pass
158 self.lock.acquire() 158 self.lock.acquire()
159 self.bot.error('===> Debug: adding participant "'+nickname+'" from "'+from_protocol+'" to bridge "'+str(self)+'"', debug=True) 159 self.bot.error('===> Debug: adding participant "'+nickname+'" from "'+from_protocol+'" to bridge "'+str(self)+'"', debug=True)
160 try: 160 try:
309 309
310 def stop(self, message='Stopping bridge'): 310 def stop(self, message='Stopping bridge'):
311 """Stop the bridge""" 311 """Stop the bridge"""
312 312
313 # Close IRC connection if not used by an other bridge, just leave the room otherwise 313 # Close IRC connection if not used by an other bridge, just leave the room otherwise
314 self.irc_connection.used_by -= 1 314 if isinstance(self.irc_connection, ServerConnection):
315 if self.irc_connection.used_by < 1: 315 self.irc_connection.used_by -= 1
316 self.irc_connection.close(message) 316 if self.irc_connection.used_by < 1:
317 else: 317 self.irc_connection.close(message)
318 self.irc_connection.part(self.irc_room, message=message) 318 else:
319 self.irc_connection.part(self.irc_room, message=message)
320 self.irc_connection = None
319 321
320 # Leave the MUC 322 # Leave the MUC
321 self.xmpp_room.leave(message=message) 323 if isinstance(self.xmpp_room, xmpp.muc):
322 self.xmpp_room.__del__() 324 self.xmpp_room.leave(message=message)
323 del self.xmpp_room 325 self.xmpp_room.__del__()
326 self.xmpp_room = None
324 327
325 # Delete participants objects 328 # Delete participants objects
326 for p in self.participants: 329 for p in self.participants:
327 p.leave(message) 330 p.leave(message)
328 del p 331 del p