Cleaner way for making channel prefix optional in join command
authorCory Chaplin <cory.chaplin@laposte.net>
Sun, 23 Feb 2014 22:42:06 +0000 (23:42 +0100)
committerCory Chaplin <cory.chaplin@laposte.net>
Sun, 23 Feb 2014 22:42:06 +0000 (23:42 +0100)
client/src/models/application.js
client/src/models/network.js

index df79770e2a507030c8cb4d6acc3ad0f1dddef6de..bc60a95be33d6a0023fbe4773fe91e1d23e12cbe 100644 (file)
     function joinCommand (ev) {\r
         var panels, channel_names;\r
 \r
-        // Add a # in front of the first channel if missing\r
-        if (ev.params[0].substring(0,1) != '#') {\r
-            ev.params[0] = '#' + ev.params[0];\r
-        }\r
-        \r
         channel_names = ev.params.join(' ').split(',');\r
         panels = this.connections.active_connection.createAndJoinChannels(channel_names);\r
 \r
index b9ecb0d4bbee3d0716e07e1d6421389d4825750f..987c9321736e90d395568b8b99184f24cb1fab53 100644 (file)
 
                 // Trim any whitespace off the name
                 channel_name = channel_name.trim();
-
-                // If not a valid channel name, display a warning
-                if (!that.isChannelName(channel_name)) {
-                    that.panels.server.addMsg('', _kiwi.global.i18n.translate('client_models_network_channel_invalid_name').fetch(channel_name));
-                    _kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_invalid_name').fetch(channel_name), {timeout: 5000});
-                    return;
+                
+                // Add channel_prefix in front of the first channel if missing
+                if (channel_name[0] != that.get('channel_prefix')) {
+                    channel_name = that.get('channel_prefix') + channel_name;
                 }
 
                 // Check if we have the panel already. If not, create it