changeset 234:c9c0d9a5e0b8

(irclib) tried to fix nick callbacks Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Mon, 08 Mar 2010 00:13:24 +0100
parents 4ad8e985c7d3
children 533a5db79389
files irclib.py
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/irclib.py
+++ b/irclib.py
@@ -726,18 +726,6 @@ class ServerConnection(Connection):
             if command in numeric_events:
                 command = numeric_events[command]
 
-            if command in ["nick", "welcome"]:
-                self.logged_in = True
-                self.real_nickname = arguments[0]
-                if self.new_nickname != arguments[0]:
-                    if len(self.new_nickname) > len(arguments[0]):
-                        self._handle_event(Event('nicknametoolong', None, None, None))
-                    else:
-                        self._handle_event(Event('erroneusnickname', None, None, None))
-                else:
-                    self._call_nick_callbacks(None)
-                self.new_nickname = None
-
             if command in ["privmsg", "notice"]:
                 target, message = arguments[0], arguments[1]
                 messages = _ctcp_dequote(message)
@@ -790,6 +778,19 @@ class ServerConnection(Connection):
                     if not is_channel(target):
                         command = "umode"
 
+                if command in ["nick", "welcome"]:
+                    self.logged_in = True
+                    self.real_nickname = target
+                    if self.new_nickname:
+                        if self.new_nickname != target:
+                            if len(self.new_nickname) > len(target):
+                                self._handle_event(Event('nicknametoolong', None, None, None))
+                            else:
+                                self._handle_event(Event('erroneusnickname', None, None, None))
+                        else:
+                            self._call_nick_callbacks(None)
+                        self.new_nickname = None
+
                 if command == "join":
                     if self.irc_id != prefix:
                         self.irc_id = prefix