* @param {Function} callback A callback function to be invoked once Kiwi's server has connected to the IRC server\r
*/\r
this.connect = function (callback) {\r
+ this.connect_callback = callback;\r
+\r
// Keep note of the server we are connecting to\r
this.set('kiwi_server', _kiwi.app.kiwi_server);\r
\r
that.disconnect_requested = false;\r
\r
console.log("_kiwi.gateway.socket.on('open')");\r
-\r
- callback && callback();\r
});\r
\r
this.rpc.on('too_many_connections', function () {\r
this.parseKiwi = function (command, data) {\r
this.trigger('kiwi:' + command, data);\r
this.trigger('kiwi', data);\r
+\r
+ switch (command) {\r
+ case 'connected':\r
+ this.connect_callback && this.connect_callback();\r
+ delete this.connect_callback;\r
+ break;\r
+ }\r
};\r
/*\r
Events:\r
});
this.disposed = false;
+
+ // Let the client know it's finished connecting
+ this.sendKiwiCommand('connected');
};
util.inherits(Client, events.EventEmitter);