changeset 78:a8749705fe94

Fixed IRC quit event handling Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Fri, 04 Sep 2009 14:21:48 +0200
parents 686724c5183c
children 73a30fc1922b
files bot.py participant.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bot.py
+++ b/bot.py
@@ -316,9 +316,6 @@ class bot(Thread):
 					self.error('=> Debug: ignoring IRC '+event.eventtype()+' sent by self', debug=True)
 					return
 			
-			if event.eventtype() == 'quit' and connection in self.irc.connections:
-				return
-			
 			# TODO: lock self.bridges for thread safety
 			for bridge in self.bridges:
 				if connection.server != bridge.irc_server:
@@ -369,6 +366,8 @@ class bot(Thread):
 				
 				# Leaving events
 				if event.eventtype() == 'quit' or event.eventtype() == 'part' and event.target().lower() == bridge.irc_room:
+					if event.eventtype() == 'quit' and ( bridge.mode != 'normal' or isinstance(from_.irc_connection, irclib.ServerConnection) ):
+						continue
 					if len(event.arguments()) > 0:
 						leave_message = event.arguments()[0]
 					elif event.eventtype() == 'quit':
--- a/participant.py
+++ b/participant.py
@@ -204,6 +204,7 @@ class participant:
 			self.muc.leave(auto_decode(message))
 			self.bridge.bot.close_xmpp_connection(self.nickname)
 		if isinstance(self.irc_connection, ServerConnection):
+			self.irc_connection.part(self.bridge.irc_room, message=message)
 			self.irc_connection.used_by -= 1
 			if self.irc_connection.used_by < 1:
 				self.irc_connection.close(message)