comparison irclib.py @ 222:1439d3274e6a

(irclib) minor changes to _call_nick_callbacks Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sun, 07 Mar 2010 16:18:51 +0100
parents 1a82d5d40d90
children 3da85bf56bdf
comparison
equal deleted inserted replaced
221:1a82d5d40d90 222:1439d3274e6a
603 self.lock.release() 603 self.lock.release()
604 return self 604 return self
605 605
606 606
607 def _call_nick_callbacks(self, error): 607 def _call_nick_callbacks(self, error):
608 i = 0 608 if len(self.nick_callbacks) == 0:
609 for f in self.nick_callbacks:
610 i += 1
611 f(error)
612 self.nick_callbacks = []
613 if i == 0:
614 self.irclibobj.bot.error(1, 'no nick callback for "'+self.__str__()+'"', debug=True) 609 self.irclibobj.bot.error(1, 'no nick callback for "'+self.__str__()+'"', debug=True)
615 else: 610 else:
616 self.irclibobj.bot.error(1, 'called '+str(i)+' callback(s) for "'+self.__str__()+'"', debug=True) 611 self.irclibobj.bot.error(1, 'calling '+str(len(self.nick_callbacks))+' nick callback(s) for "'+self.__str__()+'"', debug=True)
612 for f in self.nick_callbacks:
613 f(error)
614 self.nick_callbacks = []
617 615
618 616
619 def add_nick_callback(self, callback): 617 def add_nick_callback(self, callback):
620 self.nick_callbacks.append(callback) 618 self.nick_callbacks.append(callback)
621 619