From: Darren Date: Sat, 25 Aug 2012 20:31:25 +0000 (+0100) Subject: Updating member lists and user nick on nick changes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=967687fceea8143de22a1c895bd4626c8838a33b;p=KiwiIRC.git Updating member lists and user nick on nick changes --- diff --git a/client_backbone/model_application.js b/client_backbone/model_application.js index 080537c..ea6130d 100644 --- a/client_backbone/model_application.js +++ b/client_backbone/model_application.js @@ -191,7 +191,21 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { } else if (event.mode[0] === '-') { member.removeMode(event.mode.substr(1)); } + }); + + + gw.on('onnick', function (event) { + var member; + $.each(that.panels.models, function (index, panel) { + 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'); + } + }); }); }; diff --git a/client_backbone/model_gateway.js b/client_backbone/model_gateway.js index 52cf62f..dca83b3 100644 --- a/client_backbone/model_gateway.js +++ b/client_backbone/model_gateway.js @@ -170,7 +170,9 @@ kiwi.model.Gateway = Backbone.Model.extend(new (function () { break; case 'nick': - that.set('nick', item.newnick); + if (item.nick === that.get('nick')) { + that.set('nick', item.newnick); + } break; /* case 'sync':