Client: Applying the nick + channel given in the URL properly #242
authorDarren <darren@Darrens-MacBook-Pro.local>
Mon, 13 May 2013 14:50:48 +0000 (15:50 +0100)
committerDarren <darren@Darrens-MacBook-Pro.local>
Mon, 13 May 2013 14:50:48 +0000 (15:50 +0100)
client/assets/dev/model_application.js

index 2e96956d46c8124581e363b32082f5ed665ca820..24046284817cc666932c08059ea47252b7068db3 100644 (file)
@@ -141,11 +141,11 @@ _kiwi.model.Application = function () {
         this.populateDefaultServerSettings = function (new_connection_dialog) {\r
             var parts;\r
             var defaults = {\r
-                nick: getQueryVariable('nick') || '',\r
+                nick: '',\r
                 server: '',\r
                 port: 6667,\r
                 ssl: false,\r
-                channel: window.location.hash || '#chat',\r
+                channel: '#chat',\r
                 channel_key: ''\r
             };\r
             var uricheck;\r
@@ -153,7 +153,7 @@ _kiwi.model.Application = function () {
 \r
             /**\r
              * Get any settings set by the server\r
-             * These settings may be changed in the server selection dialog\r
+             * These settings may be changed in the server selection dialog or via URL parameters\r
              */\r
             if (this.server_settings.client) {\r
                 if (this.server_settings.client.nick)\r
@@ -179,6 +179,14 @@ _kiwi.model.Application = function () {
              * These settings may be changed in the server selection dialog\r
              */\r
 \r
+            // Any query parameters first\r
+            if (getQueryVariable('nick'))\r
+                defaults.nick = getQueryVariable('nick');\r
+\r
+            if (window.location.hash)\r
+                defaults.channel = window.location.hash;\r
+\r
+\r
             // Process the URL part by part, extracting as we go\r
             parts = window.location.pathname.toString().replace(this.get('base_path'), '').split('/');\r
 \r