Clients side IRC event names normalised
authorDarren <darren@darrenwhitlen.com>
Sat, 10 May 2014 12:15:03 +0000 (13:15 +0100)
committerDarren <darren@darrenwhitlen.com>
Sat, 10 May 2014 12:15:03 +0000 (13:15 +0100)
client/src/applets/chanlist.js
client/src/models/application.js
client/src/models/gateway.js
client/src/views/serverselect.js

index 8c286fdf7c598584ec26e8dc4a44555aa5e4bfff..bad0bc426993ff0e9f6546adfdeaadc2023dfa3f 100644 (file)
             this.view = new View();\r
 \r
             this.network = _kiwi.global.components.Network();\r
-            this.network.on('onlist_channel', this.onListChannel, this);\r
-            this.network.on('onlist_start', this.onListStart, this);\r
+            this.network.on('list_channel', this.onListChannel, this);\r
+            this.network.on('list_start', this.onListStart, this);\r
         },\r
 \r
 \r
index 82547fafc2f32f8ae3268da2421a2083bacf6fa6..74c258df91a6f4997f6b1eac2e2f24d97e5f910c 100644 (file)
         bindGatewayCommands: function (gw) {\r
             var that = this;\r
 \r
-            gw.on('onconnect', function (event) {\r
+            gw.on('connect', function (event) {\r
                 that.view.barsShow();\r
             });\r
 \r
                 });\r
 \r
 \r
-                gw.on('onconnect', function (event) {\r
+                gw.on('connect', function (event) {\r
                     that.view.$el.addClass('connected');\r
                     if (gw_stat !== 1) return;\r
 \r
index f72e9409935daa0e2b7733d3a8f6b3ff1eb30f40..97edc3edf75c915d6a38ff6fa817b69dc25db4b3 100644 (file)
@@ -9,84 +9,11 @@ _kiwi.model.Gateway = function () {
         // 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
@@ -347,6 +274,7 @@ _kiwi.model.Gateway = function () {
         }\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
@@ -354,8 +282,8 @@ _kiwi.model.Gateway = function () {
             });\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
index ded2203c435634ab7d1a013f117e97db90a0c058..271a372d32090d9a98d2685f5bc2bf1e68986c59 100644 (file)
@@ -42,16 +42,16 @@ _kiwi.view.ServerSelect = Backbone.View.extend({
         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();
     },