Fix greentext bug

This commit is contained in:
calzoneman 2013-11-19 16:14:33 -06:00
parent 21bb2b9a4e
commit b50dc3a626
3 changed files with 22 additions and 8 deletions

View file

@ -604,7 +604,10 @@ Channel.prototype.tryNameBan = function(actor, name) {
var notice = {
username: "[server]",
msg: actor.name + " banned " + name,
meta: { addClass: "server-whisper" },
meta: {
addClass: "server-whisper" ,
addClassToNameAndTimestamp: true
},
time: Date.now()
};
self.users.forEach(function(u) {
@ -716,7 +719,10 @@ Channel.prototype.tryIPBan = function(actor, name, range) {
username: "[server]",
msg: actor.name + " banned " + $util.maskIP(ip) +
" (" + name + ")",
meta: { addClass: "server-whisper" },
meta: {
addClass: "server-whisper",
addClassToNameAndTimestamp: true
},
time: Date.now()
};
self.users.forEach(function(u) {
@ -1133,7 +1139,10 @@ Channel.prototype.broadcastNewUser = function(user) {
var pkt = {
username: "[server]",
msg: msg,
meta: { addClass: "server-whisper" },
meta: {
addClass: "server-whisper",
addClassToNameAndTimestamp: true
},
time: Date.now()
};
self.sendAllWithRank(2, "joinMessage", pkt);

View file

@ -26,6 +26,7 @@ var handlers = {
"say": function (chan, user, msg, meta) {
if (user.rank >= 1.5) {
meta.addClass = "shout";
meta.addClassToNameAndTimestamp = true;
meta.forceShowName = true;
chan.sendMessage(user, msg, meta);
}
@ -196,7 +197,10 @@ function handleShadowMute(chan, user, args) {
var pkt = {
username: "[server]",
msg: user.name + " shadow muted " + args[0],
meta: { addClass: "server-whisper" },
meta: {
addClass: "server-whisper",
addClassToNameAndTimestamp: true
},
time: Date.now()
};
chan.users.forEach(function (u) {

View file

@ -1445,7 +1445,9 @@ function formatChatMessage(data) {
// Backwards compat
if (!data.meta || data.msgclass) {
data.meta = {
addClass: data.msgclass
addClass: data.msgclass,
// And the award for "variable name most like Java source code" goes to...
addClassToNameAndTimestamp: data.msgclass
};
}
// Phase 1: Determine whether to show the username or not
@ -1473,8 +1475,7 @@ function formatChatMessage(data) {
var time = $("<span/>").addClass("timestamp").appendTo(div);
var timestamp = new Date(data.time).toTimeString().split(" ")[0];
time.text("["+timestamp+"] ");
if (data.meta.addClass &&
data.meta.addClass.match(/shout|server-whisper/)) {
if (data.meta.addClass && data.meta.addClassToNameAndTimestamp) {
time.addClass(data.meta.addClass);
}
}
@ -1488,7 +1489,7 @@ function formatChatMessage(data) {
if (data.meta.modflair) {
name.addClass(getNameColor(data.meta.modflair));
}
if (data.meta.addClass) {
if (data.meta.addClass && data.meta.addClassToNameAndTimestamp) {
name.addClass(data.meta.addClass);
}
if (data.meta.superadminflair) {