# HG changeset patch # User Charly COSTE # Date 1267975131 -3600 # Node ID 1439d3274e6a7469a99aa982593acb6a801e562d # Parent 1a82d5d40d9078de0ff9003871ac00ddb888a5ea (irclib) minor changes to _call_nick_callbacks Signed-off-by: Charly COSTE diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -605,15 +605,13 @@ class ServerConnection(Connection): def _call_nick_callbacks(self, error): - i = 0 - for f in self.nick_callbacks: - i += 1 - f(error) - self.nick_callbacks = [] - if i == 0: + 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, 'called '+str(i)+' callback(s) for "'+self.__str__()+'"', debug=True) + 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) + self.nick_callbacks = [] def add_nick_callback(self, callback):