diff 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
line wrap: on
line diff
--- a/bot.py
+++ b/bot.py
@@ -363,13 +363,18 @@ class bot(Thread):
 							continue
 				
 				
-				# Rejoin on kick
+				# kick handling
 				if event.eventtype() == 'kick':
 					if event.target().lower() == bridge.irc_room:
 						try:
 							kicked = bridge.getParticipant(event.arguments()[0])
 							if isinstance(kicked.irc_connection, irclib.ServerConnection):
 								kicked.irc_connection.join(bridge.irc_room)
+							elif isinstance(kicked.xmpp_c, xmpp.client.Client):
+								if len(event.arguments()) > 1:
+									bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' with reason: '+event.arguments()[1])
+								else:
+									bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' (no reason was given)')
 							return
 						except NoSuchParticipantException:
 							self.error('=> Debug: a participant that was not here has been kicked ? WTF ?')