Updating the nick within IrcConnection on change
authorDarren <darren@darrenwhitlen.com>
Tue, 29 Jan 2013 01:28:34 +0000 (01:28 +0000)
committerDarren <darren@darrenwhitlen.com>
Thu, 31 Jan 2013 14:58:44 +0000 (14:58 +0000)
server/irc/connection.js

index a61e2c4319bd9cd2803cfcb14a2001619b876780..311c811b1965bbed6643ca44484d2acd282b99eb 100644 (file)
@@ -82,6 +82,7 @@ IrcConnection.prototype.applyIrcEvents = function () {
 
         // TODO: uncomment when using an IrcUser per nick
         //'user:*:privmsg':    onUserPrivmsg,
+        'user:*:nick':       onUserNick,
         'channel:*:part':    onUserParts,
         'channel:*:quit':    onUserParts,
         'channel:*:kick':    onUserParts
@@ -250,6 +251,17 @@ function onUserPrivmsg(event) {
 }
 
 
+function onUserNick(event) {
+    var user;
+
+    // Only deal with messages targetted to us
+    if (event.nick !== this.nick)
+        return;
+
+    this.nick = event.newnick;
+}
+
+
 function onUserParts(event) {
     // Only deal with ourselves leaving a channel
     if (event.nick !== this.nick)