Second IRC connection via /server fix
authorDarren <darren@darrenwhitlen.com>
Sun, 29 Dec 2013 20:31:29 +0000 (20:31 +0000)
committerDarren <darren@darrenwhitlen.com>
Sun, 29 Dec 2013 20:31:29 +0000 (20:31 +0000)
client/src/models/newconnection.js

index 9899c926cdde2970b080b699f61d25f534a0865d..8d1b558f1ba905f97bca076e6b916dc4ba72ec58 100644 (file)
@@ -14,11 +14,16 @@ _kiwi.model.NewConnection = Backbone.Collection.extend({
 
         this.view.networkConnecting();
 
-
-        _kiwi.gateway.set('kiwi_server', _kiwi.app.kiwi_server);
-        _kiwi.gateway.connect(function() {
-            that.makeConnection(new_connection_event);
-        });
+        // If not connected already, connect then send the IRC connect info
+        if (!_kiwi.gateway.isConnected()) {
+            _kiwi.gateway.set('kiwi_server', _kiwi.app.kiwi_server);
+            _kiwi.gateway.connect(function() {
+                that.makeConnection(new_connection_event);
+            });
+
+        } else {
+            this.makeConnection(new_connection_event);
+        }
 
 
     },