From eed5ac29cdf362b589f881df91347a87bb7e1ec3 Mon Sep 17 00:00:00 2001 From: Vinicius Daly Felizardo Date: Thu, 13 Jun 2013 22:36:15 -0400 Subject: [PATCH] [ISSUE 250] Showing message when user is kicked or kick --- client/assets/src/models/channel.js | 23 +++++++++++++++++------ client/assets/src/models/network.js | 9 ++++++--- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/client/assets/src/models/channel.js b/client/assets/src/models/channel.js index 8e90c83..5c7cb5f 100644 --- a/client/assets/src/models/channel.js +++ b/client/assets/src/models/channel.js @@ -27,19 +27,30 @@ _kiwi.model.Channel = _kiwi.model.Panel.extend({ members.bind("remove", function (member, members, options) { var show_message = _kiwi.global.settings.get('show_joins_parts'); - if (show_message === false) { - return; - } + var msg = (options.message) ? '(' + options.message + ')' : ''; if (options.type === 'quit') { - this.addMsg(' ', '== ' + member.displayNick(true) + ' has quit ' + msg, 'action quit'); + + this.addMsg(' ', '== ' + member.displayNick(true) + ' has quit ' + msg, 'action quit'); + } else if(options.type === 'kick') { - this.addMsg(' ', '== ' + member.displayNick(true) + ' was kicked by ' + options.by + ' ' + msg, 'action kick'); + + if (!options.kicked) { + + if (show_message || options.kicker) { + this.addMsg(' ', '== ' + member.displayNick(true) + ' was kicked by ' + options.by + ' ' + msg, 'action kick'); + + } + + } else { + this.addMsg(' ', '=== You have been kicked by ' + options.by + ' '+msg, 'action kick'); + } + } else { this.addMsg(' ', '== ' + member.displayNick(true) + ' has left ' + msg, 'action part'); } }, this); } -}); \ No newline at end of file +}); diff --git a/client/assets/src/models/network.js b/client/assets/src/models/network.js index 92f49a5..a2330f8 100644 --- a/client/assets/src/models/network.js +++ b/client/assets/src/models/network.js @@ -279,6 +279,8 @@ part_options.type = 'kick'; part_options.by = event.nick; part_options.message = event.message || ''; + part_options.kicked = (event.kicked == this.get('nick')) + part_options.kicker = (event.nick == this.get('nick')) channel = this.panels.getByName(event.channel); if (!channel) return; @@ -289,10 +291,11 @@ user = members.getByNick(event.kicked); if (!user) return; + members.remove(user, part_options); - if (event.kicked === this.get('nick')) { - members.reset([]); + if (part_options.kicked) { + members.reset([]); } } @@ -698,4 +701,4 @@ } } -)(); \ No newline at end of file +)(); -- 2.25.1