# HG changeset patch # User Charly COSTE # Date 1267999398 -3600 # Node ID 5f1e9211af035cda40eeaf05f0bdae037860b005 # Parent d5a126cf119ca348aac50536d834f25d61df7021 fix for 48ad162772b79740e8ff580bde2c250b9957c126, we do need arguments in nick callbacks Signed-off-by: Charly COSTE diff --git a/bridge.py b/bridge.py --- 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 diff --git a/irclib.py b/irclib.py --- 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) diff --git a/participant.py b/participant.py --- 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')