Merge pull request #478 from Xaekai/shadowmute

Fix shadowmuted users usage of greentext and slash commands
This commit is contained in:
Calvin Montgomery 2015-05-19 13:02:17 -04:00
commit a38e4ef409
1 changed files with 20 additions and 21 deletions

View File

@ -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);
}
};
ChatModule.prototype.formatMessage = function (username, data) {