From: Darren Date: Sat, 4 May 2013 15:03:54 +0000 (+0100) Subject: Client: showing nick changes; Updating tab name on nick change X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e2c54b3e54880ff53f342660d5dffa081c662e57;p=KiwiIRC.git Client: showing nick changes; Updating tab name on nick change --- diff --git a/client/assets/dev/model_network.js b/client/assets/dev/model_network.js index aa35f00..c21f5e8 100644 --- a/client/assets/dev/model_network.js +++ b/client/assets/dev/model_network.js @@ -68,6 +68,7 @@ this.gateway.on('quit', onQuit, this); this.gateway.on('kick', onKick, this); this.gateway.on('msg', onMsg, this); + this.gateway.on('nick', onNick, this); this.gateway.on('ctcp_request', onCtcpRequest, this); this.gateway.on('ctcp_response', onCtcpResponse, this); this.gateway.on('notice', onNotice, this); @@ -297,6 +298,25 @@ + function onNick(event) { + var member; + + $.each(this.panels.models, function (index, panel) { + if (panel.get('name') == event.nick) + panel.set('name', event.newnick); + + if (!panel.isChannel()) return; + + member = panel.get('members').getByNick(event.nick); + if (member) { + member.set('nick', event.newnick); + panel.addMsg('', '== ' + event.nick + ' is now known as ' + event.newnick, 'action nick'); + } + }); + } + + + function onCtcpRequest(event) { // An ignored user? don't do anything with it if (_kiwi.gateway.isNickIgnored(event.nick)) { diff --git a/client/assets/dev/view.js b/client/assets/dev/view.js index feccd44..383a2c5 100644 --- a/client/assets/dev/view.js +++ b/client/assets/dev/view.js @@ -800,6 +800,8 @@ _kiwi.view.Tabs = Backbone.View.extend({ panel.tab.appendTo(this.$el); panel.bind('change:title', this.updateTabTitle); + panel.bind('change:name', this.updateTabTitle); + _kiwi.app.view.doLayout(); }, panelRemoved: function (panel) {