ControlInput updating nick view properly
authorDarren <darren@Darrens-MacBook-Pro.local>
Sun, 28 Apr 2013 14:24:05 +0000 (15:24 +0100)
committerDarren <darren@Darrens-MacBook-Pro.local>
Sun, 28 Apr 2013 14:24:05 +0000 (15:24 +0100)
client/assets/dev/view.js

index 7956e726016bf40edf6889e1c5ed4dcc1de94f8a..428ff5a91e7a300d82585ca97933b79c43be81ba 100644 (file)
@@ -924,9 +924,13 @@ _kiwi.view.ControlBox = Backbone.View.extend({
         // Hold tab autocomplete data\r
         this.tabcomplete = {active: false, data: [], prefix: ''};\r
 \r
-        // When we get any nick change event for any connection, update our view just incase it's us\r
-        _kiwi.gateway.bind('onnick', function (event) {\r
-            $('.nick', that.$el).text(_kiwi.app.connections.active_connection.get('nick'));\r
+        // Keep the nick view updated with nick changes\r
+        _kiwi.app.connections.on('change:nick', function(connection) {\r
+            // Only update the nick view if it's the active connection\r
+            if (connection !== _kiwi.app.connections.active_connection)\r
+                return;\r
+\r
+            $('.nick', that.$el).text(connection.get('nick'));\r
         });\r
 \r
         // Update our nick view as we flick between connections\r