From: Darren Date: Mon, 13 May 2013 14:50:48 +0000 (+0100) Subject: Client: Applying the nick + channel given in the URL properly #242 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5e84a85a544dc971312d9937f1cd3c262cdc6051;p=KiwiIRC.git Client: Applying the nick + channel given in the URL properly #242 --- diff --git a/client/assets/dev/model_application.js b/client/assets/dev/model_application.js index 2e96956..2404628 100644 --- a/client/assets/dev/model_application.js +++ b/client/assets/dev/model_application.js @@ -141,11 +141,11 @@ _kiwi.model.Application = function () { this.populateDefaultServerSettings = function (new_connection_dialog) { var parts; var defaults = { - nick: getQueryVariable('nick') || '', + nick: '', server: '', port: 6667, ssl: false, - channel: window.location.hash || '#chat', + channel: '#chat', channel_key: '' }; var uricheck; @@ -153,7 +153,7 @@ _kiwi.model.Application = function () { /** * Get any settings set by the server - * These settings may be changed in the server selection dialog + * These settings may be changed in the server selection dialog or via URL parameters */ if (this.server_settings.client) { if (this.server_settings.client.nick) @@ -179,6 +179,14 @@ _kiwi.model.Application = function () { * These settings may be changed in the server selection dialog */ + // Any query parameters first + if (getQueryVariable('nick')) + defaults.nick = getQueryVariable('nick'); + + if (window.location.hash) + defaults.channel = window.location.hash; + + // Process the URL part by part, extracting as we go parts = window.location.pathname.toString().replace(this.get('base_path'), '').split('/');