comparison bot.py @ 92:aae8870b3727

Better handling of IRC kick Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Tue, 22 Sep 2009 18:24:40 +0200
parents 69e4fc0f015c
children c95fe0b319d9
comparison
equal deleted inserted replaced
91:69e4fc0f015c 92:aae8870b3727
361 return 361 return
362 else: 362 else:
363 continue 363 continue
364 364
365 365
366 # Rejoin on kick 366 # kick handling
367 if event.eventtype() == 'kick': 367 if event.eventtype() == 'kick':
368 if event.target().lower() == bridge.irc_room: 368 if event.target().lower() == bridge.irc_room:
369 try: 369 try:
370 kicked = bridge.getParticipant(event.arguments()[0]) 370 kicked = bridge.getParticipant(event.arguments()[0])
371 if isinstance(kicked.irc_connection, irclib.ServerConnection): 371 if isinstance(kicked.irc_connection, irclib.ServerConnection):
372 kicked.irc_connection.join(bridge.irc_room) 372 kicked.irc_connection.join(bridge.irc_room)
373 elif isinstance(kicked.xmpp_c, xmpp.client.Client):
374 if len(event.arguments()) > 1:
375 bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' with reason: '+event.arguments()[1])
376 else:
377 bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' (no reason was given)')
373 return 378 return
374 except NoSuchParticipantException: 379 except NoSuchParticipantException:
375 self.error('=> Debug: a participant that was not here has been kicked ? WTF ?') 380 self.error('=> Debug: a participant that was not here has been kicked ? WTF ?')
376 return 381 return
377 else: 382 else: