From 3b5c8a43f22bba12f5aadc42ee388cef06bbb85b Mon Sep 17 00:00:00 2001 From: Darren Date: Thu, 3 Jul 2014 20:52:38 +0100 Subject: [PATCH] Including nick prefix into message objects --- client/src/models/channel.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/src/models/channel.js b/client/src/models/channel.js index 0fe8d43..e407c6c 100644 --- a/client/src/models/channel.js +++ b/client/src/models/channel.js @@ -51,7 +51,7 @@ _kiwi.model.Channel = _kiwi.model.Panel.extend({ addMsg: function (nick, msg, type, opts) { - var message_obj, bs, d, + var message_obj, bs, d, members, member, scrollback = (parseInt(_kiwi.global.settings.get('scrollback'), 10) || 250); opts = opts || {}; @@ -68,11 +68,16 @@ _kiwi.model.Channel = _kiwi.model.Panel.extend({ opts.style = ''; } - // Run through the plugins + // Create a message object message_obj = {"msg": msg, "date": opts.date, "time": opts.time, "nick": nick, "chan": this.get("name"), "type": type, "style": opts.style}; - //tmp = _kiwi.plugs.run('addmsg', message_obj); - if (!message_obj) { - return; + + // If this user has one, get its prefix + members = this.get('members'); + if (members) { + member = members.getByNick(message_obj.nick); + if (member) { + message_obj.nick_prefix = member.get('prefix'); + } } // The CSS class (action, topic, notice, etc) -- 2.25.1