// For ease of access. The socket.io object\r
this.socket = this.get('socket');\r
\r
- this.applyEventHandlers();\r
-\r
// Used to check if a disconnection was unplanned\r
this.disconnect_requested = false;\r
};\r
\r
\r
- this.applyEventHandlers = function () {\r
- /*\r
- kiwi.gateway.on('message:#channel', my_function);\r
- kiwi.gateway.on('message:somenick', my_function);\r
-\r
- kiwi.gateway.on('notice:#channel', my_function);\r
- kiwi.gateway.on('action:somenick', my_function);\r
-\r
- kiwi.gateway.on('join:#channel', my_function);\r
- kiwi.gateway.on('part:#channel', my_function);\r
- kiwi.gateway.on('quit', my_function);\r
- */\r
- var that = this;\r
-\r
- // Some easier handler events\r
- this.on('onmsg', function (event) {\r
- var source,\r
- connection = _kiwi.app.connections.getByConnectionId(event.server),\r
- is_pm = (event.target.toLowerCase() == connection.get('nick').toLowerCase());\r
-\r
- source = is_pm ? event.nick : event.target;\r
-\r
- that.trigger('message:' + source, event);\r
- that.trigger('message', event);\r
-\r
- if (is_pm) {\r
- that.trigger('pm:' + source, event);\r
- that.trigger('pm', event);\r
- }\r
- }, this);\r
-\r
-\r
- this.on('onnotice', function (event) {\r
- // The notice towards a channel or a query window?\r
- var source = event.target || event.nick;\r
-\r
- this.trigger('notice:' + source, event);\r
- this.trigger('notice', event);\r
- }, this);\r
-\r
-\r
- this.on('onaction', function (event) {\r
- var source,\r
- connection = _kiwi.app.connections.getByConnectionId(event.server),\r
- is_pm = (event.target.toLowerCase() == connection.get('nick').toLowerCase());\r
-\r
- source = is_pm ? event.nick : event.target;\r
-\r
- that.trigger('action:' + source, event);\r
-\r
- if (is_pm) {\r
- that.trigger('action:' + source, event);\r
- that.trigger('action', event);\r
- }\r
- }, this);\r
-\r
-\r
- this.on('ontopic', function (event) {\r
- that.trigger('topic:' + event.channel, event);\r
- that.trigger('topic', event);\r
- });\r
-\r
-\r
- this.on('onjoin', function (event) {\r
- that.trigger('join:' + event.channel, event);\r
- that.trigger('join', event);\r
- });\r
-\r
- };\r
-\r
-\r
\r
this.reconnect = function (callback) {\r
var that = this,\r
}\r
\r
\r
+ // Trigger the connection specific events (used by Network objects)\r
if (typeof data.server !== 'undefined') {\r
that.trigger('connection:' + data.server.toString(), {\r
event_name: command,\r
});\r
}\r
\r
- // Trigger the global events (Mainly legacy now)\r
- that.trigger('on' + command, data);\r
+ // Trigger the global events\r
+ that.trigger(command, data);\r
};\r
\r
/**\r
this.more_shown = false;
this.model.bind('new_network', this.newNetwork, this);
- _kiwi.gateway.bind('onconnect', this.networkConnected, this);
+ _kiwi.gateway.bind('connect', this.networkConnected, this);
_kiwi.gateway.bind('connecting', this.networkConnecting, this);
- _kiwi.gateway.bind('onirc_error', this.onIrcError, this);
+ _kiwi.gateway.bind('irc_error', this.onIrcError, this);
},
dispose: function() {
this.model.off('new_network', this.newNetwork, this);
- _kiwi.gateway.off('onconnect', this.networkConnected, this);
+ _kiwi.gateway.off('connect', this.networkConnected, this);
_kiwi.gateway.off('connecting', this.networkConnecting, this);
- _kiwi.gateway.off('onirc_error', this.onIrcError, this);
+ _kiwi.gateway.off('irc_error', this.onIrcError, this);
this.remove();
},