comparison irclib.py @ 166:0fc24e232997

some fixes related to IRC nicknames Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Wed, 20 Jan 2010 14:48:52 +0100
parents 12d564cd0203
children f4997d50e93b
comparison
equal deleted inserted replaced
165:12d564cd0203 166:0fc24e232997
698 self._handle_event(Event(command, prefix, target, arguments)) 698 self._handle_event(Event(command, prefix, target, arguments))
699 699
700 def _handle_event(self, event): 700 def _handle_event(self, event):
701 """[Internal]""" 701 """[Internal]"""
702 self.irclibobj._handle_event(self, event) 702 self.irclibobj._handle_event(self, event)
703 if event.eventtype() in ['disconnect', 'nicknameinuse', 'nickcollision', 'erroneusnickname']:
704 self._call_nick_callbacks(event.eventtype(), arguments=[event])
703 if event.eventtype() in self.handlers: 705 if event.eventtype() in self.handlers:
704 for fn in self.handlers[event.eventtype()]: 706 for fn in self.handlers[event.eventtype()]:
705 fn(self, event) 707 fn(self, event)
706 708
707 def is_connected(self): 709 def is_connected(self):
838 840
839 def nick(self, newnick, callback=None): 841 def nick(self, newnick, callback=None):
840 """Send a NICK command.""" 842 """Send a NICK command."""
841 if callback != None: 843 if callback != None:
842 self.add_nick_callback(callback) 844 self.add_nick_callback(callback)
843 if re.search('[ \.]', newnick) != None: 845 if re.search('[ \.\']', newnick) != None:
844 self._call_nick_callbacks('erroneusnickname') 846 self._call_nick_callbacks('erroneusnickname')
845 return False 847 return False
846 try: 848 try:
847 str(newnick) 849 str(newnick)
848 except: 850 except: