Auto-joining to specificed channel
authorDarren <darren@darrenwhitlen.com>
Fri, 31 Aug 2012 21:43:20 +0000 (22:43 +0100)
committerDarren <darren@darrenwhitlen.com>
Fri, 31 Aug 2012 21:43:20 +0000 (22:43 +0100)
client_backbone/model_application.js

index b53e192419f48023942bb99ceb7eaf007d6d383a..80c1521ba1e55d3d7a8a6a300dcce4e7dafaabd9 100644 (file)
@@ -1,6 +1,9 @@
 kiwi.model.Application = Backbone.Model.extend(new (function () {\r
     var that = this;\r
 \r
+    // The auto connect details entered into the server select box\r
+    var auto_connect_details = {};\r
+\r
     /** Instance of kiwi.model.PanelList */\r
     this.panels = null;\r
 \r
@@ -18,10 +21,10 @@ kiwi.model.Application = Backbone.Model.extend(new (function () {
         this.panels.server.server_login.on('server_connect', function (event) {\r
             var form = this;\r
 \r
+            auto_connect_details = event;\r
+\r
             kiwi.gateway.set('nick', event.nick);\r
-            kiwi.gateway.connect(event.server, 6667, false, false, function () {\r
-                that.view.barsShow();\r
-            });\r
+            kiwi.gateway.connect(event.server, 6667, false, false, function () {});\r
         });\r
 \r
     };\r
@@ -60,7 +63,13 @@ kiwi.model.Application = Backbone.Model.extend(new (function () {
         });\r
 \r
 \r
-        gw.on('onconnect', function (event) {});\r
+        gw.on('onconnect', function (event) {\r
+            that.view.barsShow();\r
+            \r
+            if (auto_connect_details.channel) {\r
+                kiwi.gateway.join(auto_connect_details.channel);\r
+            }\r
+        });\r
 \r
 \r
         gw.on('onjoin', function (event) {\r