diff 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
line wrap: on
line diff
--- a/irclib.py
+++ b/irclib.py
@@ -700,6 +700,8 @@ class ServerConnection(Connection):
     def _handle_event(self, event):
         """[Internal]"""
         self.irclibobj._handle_event(self, event)
+        if event.eventtype() in ['disconnect', 'nicknameinuse', 'nickcollision', 'erroneusnickname']:
+            self._call_nick_callbacks(event.eventtype(), arguments=[event])
         if event.eventtype() in self.handlers:
             for fn in self.handlers[event.eventtype()]:
                 fn(self, event)
@@ -840,7 +842,7 @@ class ServerConnection(Connection):
         """Send a NICK command."""
         if callback != None:
             self.add_nick_callback(callback)
-        if re.search('[ \.]', newnick) != None:
+        if re.search('[ \.\']', newnick) != None:
             self._call_nick_callbacks('erroneusnickname')
             return False
         try: