From 7f269784b15369304ca5f2de3e0ad8332dc74a4c Mon Sep 17 00:00:00 2001 From: Xaekai Date: Tue, 19 May 2015 00:03:02 -0700 Subject: [PATCH] Fix shadowmuted users usage of greentext and slash commands --- lib/channel/chat.js | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lib/channel/chat.js b/lib/channel/chat.js index a6e71b7b..a395d521 100644 --- a/lib/channel/chat.js +++ b/lib/channel/chat.js @@ -268,6 +268,25 @@ ChatModule.prototype.processChatMsg = function (user, data) { return; } + if (data.msg.indexOf(">") === 0) { + msgobj.meta.addClass = "greentext"; + } + + if (data.msg.indexOf("/") === 0) { + var space = data.msg.indexOf(" "); + var cmd; + if (space < 0) { + cmd = data.msg.substring(1); + } else { + cmd = data.msg.substring(1, space); + } + + if (cmd in this.commandHandlers) { + this.commandHandlers[cmd](user, data.msg, data.meta); + return; + } + } + if (user.is(Flags.U_SMUTED)) { this.shadowMutedUsers().forEach(function (u) { u.socket.emit("chatMsg", msgobj); @@ -284,27 +303,7 @@ ChatModule.prototype.processChatMsg = function (user, data) { }); return; } - - if (data.msg.indexOf("/") === 0) { - var space = data.msg.indexOf(" "); - var cmd; - if (space < 0) { - cmd = data.msg.substring(1); - } else { - cmd = data.msg.substring(1, space); - } - - if (cmd in this.commandHandlers) { - this.commandHandlers[cmd](user, data.msg, data.meta); - } else { - this.sendMessage(msgobj); - } - } else { - if (data.msg.indexOf(">") === 0) { - msgobj.meta.addClass = "greentext"; - } - this.sendMessage(msgobj); - } + this.sendMessage(msgobj); }; ChatModule.prototype.formatMessage = function (username, data) {