Don't auto connect an IRC connection in the constructor
authorDarren <darren@darrenwhitlen.com>
Wed, 10 Jul 2013 14:48:01 +0000 (15:48 +0100)
committerDarren <darren@darrenwhitlen.com>
Wed, 10 Jul 2013 14:48:01 +0000 (15:48 +0100)
server/irc/connection.js
server/irc/state.js

index 2c9ad82949dcb08ffb236f1cb886434b61f913f7..df9b5b9b1ddec91919554a6659293cea8c21f70f 100644 (file)
@@ -92,12 +92,6 @@ var IrcConnection = function (hostname, port, ssl, nick, user, pass, state) {
     this.held_data = '';
 
     this.applyIrcEvents();
-
-    // Call any modules before making the connection
-    global.modules.emit('irc connecting', {connection: this})
-        .done(function () {
-            that.connect();
-        });
 };
 util.inherits(IrcConnection, EE);
 
index 368684ee5b96d88d5fdbd36a097d2d74cce4c132..776ab5db2aa73104ec6e886df9a4dbb9e018b95d 100755 (executable)
@@ -80,6 +80,12 @@ State.prototype.connect = function (hostname, port, ssl, nick, user, pass, callb
         that.irc_connections[con_num] = null;
         global.servers.removeConnection(this);
     });
+
+    // Call any modules before making the connection
+    global.modules.emit('irc connecting', {connection: con})
+        .done(function () {
+            con.connect();
+        });
 };
 
 State.prototype.sendIrcCommand = function () {