From: Darren Date: Wed, 16 Jul 2014 21:40:02 +0000 (+0100) Subject: Trigger message:* channel:* events for global Network() object X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7fadc874931675ff6d56ec392cc61f7d77644fb3;p=KiwiIRC.git Trigger message:* channel:* events for global Network() object --- diff --git a/client/src/models/gateway.js b/client/src/models/gateway.js index 01f92e8..d5af31f 100644 --- a/client/src/models/gateway.js +++ b/client/src/models/gateway.js @@ -217,24 +217,27 @@ _kiwi.model.Gateway = function () { * Parses the response from the server */ this.parse = function (command, data) { + var network_trigger = ''; // Trigger the connection specific events (used by Network objects) if (typeof data.connection_id !== 'undefined') { - that.trigger('connection:' + data.connection_id.toString(), { + network_trigger = 'connection:' + data.connection_id.toString(); + + that.trigger(network_trigger, { event_name: command, event_data: data }); // Some events trigger a more in-depth event name if (command == 'message' && data.type) { - that.trigger('connection:' + data.connection_id.toString(), { + that.trigger('connection ' + network_trigger, { event_name: 'message:' + data.type, event_data: data }); } if (command == 'channel' && data.type) { - that.trigger('connection:' + data.connection_id.toString(), { + that.trigger('connection ' + network_trigger, { event_name: 'channel:' + data.type, event_data: data });