changeset 231:5f1e9211af03

fix for 48ad162772b79740e8ff580bde2c250b9957c126, we do need arguments in nick callbacks Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sun, 07 Mar 2010 23:03:18 +0100
parents d5a126cf119c
children 02c58515edde
files bridge.py irclib.py participant.py
diffstat 3 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bridge.py
+++ b/bridge.py
@@ -75,7 +75,7 @@ class Bridge:
 		self.stop(message='Failed to connect to the IRC chan, stopping bridge', log=False)
 	
 	
-	def _irc_nick_callback(self, error):
+	def _irc_nick_callback(self, error, arguments=None):
 		if not error:
 			if not self.mode:
 				return
--- a/irclib.py
+++ b/irclib.py
@@ -605,13 +605,13 @@ class ServerConnection(Connection):
         return self
 
 
-    def _call_nick_callbacks(self, error):
+    def _call_nick_callbacks(self, error, arguments=[]):
         if len(self.nick_callbacks) == 0:
             self.irclibobj.bot.error(1, 'no nick callback for "'+self.__str__()+'"', debug=True)
         else:
             self.irclibobj.bot.error(1, 'calling '+str(len(self.nick_callbacks))+' nick callback(s) for "'+self.__str__()+'"', debug=True)
             for f in self.nick_callbacks:
-                f(error)
+                f(error, arguments=arguments)
         self.nick_callbacks = []
 
 
@@ -819,7 +819,7 @@ class ServerConnection(Connection):
         """[Internal]"""
         self.irclibobj._handle_event(self, event)
         if event.eventtype() in ['disconnect', 'nicknameinuse', 'nickcollision', 'erroneusnickname', 'nicknametoolong']:
-            self._call_nick_callbacks(event.eventtype())
+            self._call_nick_callbacks(event.eventtype(), arguments=[event])
         if event.eventtype() in self.handlers:
             for fn in self.handlers[event.eventtype()]:
                 fn(self, event)
--- a/participant.py
+++ b/participant.py
@@ -114,7 +114,7 @@ class Participant:
 		self.irc_connection.connect(nick_callback=self._irc_nick_callback)
 	
 	
-	def _irc_nick_callback(self, error):
+	def _irc_nick_callback(self, error, arguments=None):
 		if not error:
 			self.irc_connection.join(self.bridge.irc_room, callback=self._irc_join_callback)
 		
@@ -126,7 +126,7 @@ class Participant:
 				
 				if self.bridge.mode == 'bypass':
 					new_duplicate_nickname = self._get_new_duplicate_nickname()
-					if new_duplicate_nickname != None:
+					if new_duplicate_nickname:
 						self.bridge.bot.error(3, '"'+self.duplicate_nickname+'" is already used or reserved on the IRC server of bridge "'+str(self.bridge)+'", trying "'+new_duplicate_nickname+'"', debug=True)
 						if self.duplicate_nickname == self.nickname:
 							self.bridge.say(say_levels.info, 'The nickname "'+self.duplicate_nickname+'" is used or reserved on the IRC server')