From: Cory Chaplin Date: Sun, 23 Feb 2014 22:42:06 +0000 (+0100) Subject: Cleaner way for making channel prefix optional in join command X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b8bba51ef6159d2ec5cb5a50dd9e8d1f81c108d5;p=KiwiIRC.git Cleaner way for making channel prefix optional in join command --- diff --git a/client/src/models/application.js b/client/src/models/application.js index df79770..bc60a95 100644 --- a/client/src/models/application.js +++ b/client/src/models/application.js @@ -679,11 +679,6 @@ function joinCommand (ev) { var panels, channel_names; - // Add a # in front of the first channel if missing - if (ev.params[0].substring(0,1) != '#') { - ev.params[0] = '#' + ev.params[0]; - } - channel_names = ev.params.join(' ').split(','); panels = this.connections.active_connection.createAndJoinChannels(channel_names); diff --git a/client/src/models/network.js b/client/src/models/network.js index b9ecb0d..987c932 100644 --- a/client/src/models/network.js +++ b/client/src/models/network.js @@ -167,12 +167,10 @@ // 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