Respond to ERR_ERONEOUSNICKNAME
authorJack Allnutt <m2ys4u@gmail.com>
Tue, 4 Jun 2013 15:30:48 +0000 (16:30 +0100)
committerJack Allnutt <m2ys4u@gmail.com>
Tue, 4 Jun 2013 15:30:48 +0000 (16:30 +0100)
client/assets/src/models/network.js
client/assets/src/views/serverselect.js
server/irc/commands.js
server/irc/server.js

index f8e70ee997686802b0b9e73b8f46063fec9859df..88cc854b150a355dca86fc39e1c82fef0e351834 100644 (file)
             }
 
             break;
+        case 'erroneus_nickname':
+            this.panels.server.addMsg(' ', '== The nickname ' + event.nick + ' is not valid for this network. Please select a new nickname', 'status');
+            if (this.panels.server !== this.panels.active) {
+                _kiwi.app.message.text('The nickname "' + event.nick + '" is not valid for this network. Please select a new nickname');
+            }
+
+            // Only show the nickchange component if the controlbox is open
+            if (_kiwi.app.controlbox.$el.css('display') !== 'none') {
+                (new _kiwi.view.NickChangeBox()).render();
+            }
+            break;
 
         case 'password_mismatch':
             this.panels.server.addMsg(' ', '== Incorrect password given', 'status');
index f6552127fdd74eaa5af4f5296a0fdf9226ad2c6d..1fcd278923f1b464dd6690a303299dc09643cd90 100644 (file)
@@ -201,15 +201,22 @@ _kiwi.view.ServerSelect = function () {
         onIrcError: function (data) {
             $('button', this.$el).attr('disabled', null);
 
-            if (data.error == 'nickname_in_use') {
+            switch(data.error) {
+            case 'nickname_in_use':
                 this.setStatus('Nickname already taken');
                 this.show('nick_change');
-            }
-
-            if (data.error == 'password_mismatch') {
+                this.$el.find('.nick').select();
+                break;
+            case 'erroneus_nickname':
+                this.setStatus('Erroneus nickname');
+                this.show('nick_change');
+                this.$el.find('.nick').select();
+                break;
+            case 'password_mismatch':
                 this.setStatus('Incorrect Password');
                 this.show('nick_change');
-                that.$el.find('.password').select();
+                this.$el.find('.password').select();
+                break;
             }
         },
 
index 1e07ac837341dc472b6a17d08bfc4796fd121481..d64934ab6ddaf759de6de83bdbf5d382ab5b4bce 100644 (file)
@@ -47,6 +47,7 @@ irc_numerics = {
     '405': 'ERR_TOOMANYCHANNELS',
     '421': 'ERR_UNKNOWNCOMMAND',
     '422': 'ERR_NOMOTD',
+    '432': 'ERR_ERRONEUSNICKNAME',
     '433': 'ERR_NICKNAMEINUSE',
     '441': 'ERR_USERNOTINCHANNEL',
     '442': 'ERR_NOTONCHANNEL',
@@ -716,6 +717,13 @@ handlers = {
         });
     },
 
+    ERR_ERRONEUSNICKNAME: function(command) {
+        this.irc_connection.emit('server ' + this.irc_connection.irc_host.hostname + ' erroneus_nickname', {
+            nick: command.params[1],
+            reason: command.trailing
+        });
+    },
+
     ERR_NOTREGISTERED: function (command) {
     },
 
index 49f06d831d65c90617e98c46455e87e9bfc5f93b..e68766fce7989d99e0ca95ac7816b941b6d78aef 100755 (executable)
@@ -30,7 +30,8 @@ var IrcServer = function (irc_connection) {
         banned_from_channel:    onBannedFromChannel,
         bad_channel_key:        onBadChannelKey,
         chanop_privs_needed:    onChanopPrivsNeeded,
-        nickname_in_use:        onNicknameInUse
+        nickname_in_use:        onNicknameInUse,
+        erroneus_nickname:      onErroneusNickname
     };
     EventBinder.bindIrcEvents('server *', this.irc_events, this, this.irc_connection);
 
@@ -227,3 +228,11 @@ function onNicknameInUse(event) {
         reason: event.reason
     });
 }
+
+function onErroneusNickname(event) {
+    this.irc_connection.clientEvent('irc_error', {
+        error: 'erroneus_nickname',
+        nick: event.nick,
+        reason: event.reason
+    });
+}