Probably by accident.
The method that handles "channel" messages was supposed to detect System Messages and Mod Warnings/Announcements. Both of those come wrapped in <font color=red></font>. We used to strip out all <font></font> before looking at the message. When I made it not strip out those tags, both kinds of red messages stopped working correctly, for different reasons.
- Mod messages did not look like they had a channel, because they started with <font color=red><font color=green> and CHANNEL_PATTERN couldn't handle two fonts like that. Therefore, we interpreted them as Events, rather than as messages associated with a single channel. I strip out the red font tags that surround the whole message and voila - now they show up in red in the correct channel.
- That would probably have made System Messages work as before, too, but while debugging this, I discovered that those didn't work quite right, either. Since they did not have a green font, the single red font they were wrapped in actually did pass CHANNEL_PATTERN, but the <b> tag they are also wrapped in confused SENDER_PATTERN and we couldn't figure out who they were from. As a result, they were interpreted as Event messages and were broadcast to all channels in green, rather than being shown in the current channel in red. That is the behavior you remember. I changed the SENDER_PATTERN to allow the entire message to be wrapped in bold tags, and now they are recognized as System Messages and are shown in red in the current channel.
Now, why did both kinds of messages cause the NEXT line to also get interpreted as an event? That was a result of the malformed HTML for the red messages: the lines ended like this: <br></b></font>. We already had code to move the </b> before the <br>, but not the </font> - and the presence of that tag in the next message made it, too, not look like a "channel" message, and therefore made it an "event". I made it move the badly placed </font> tag before the <br>.
The net result of all those changes is that Mod and System messages now appear in red and appear in a single channel.
What happens in the native chat when a System message comes? If you are running lchat - no tabs - all channels are glommed into the single window and the system message is displayed there, but what if you have multiple tabs? I expect it shows it in your current tab, but does it ALSO put it in to the other tabs? Looking at mchat.js, I see this:
Code:
var whereIGo = function (msg) {
var where = opts[msg.type == 'system' ? 'event' : msg.type];
switch (where) {
case 'main':
if (msg.type == 'public') { msg.ctag = true};
return $cw;
case 'own': return getTab(msg);
case 'active': return $$('.chatdisplay:visible');
//default: console.log('missing! ' + where); return $cw;
}
};
and looking at the "opts" array, I see this:
Code:
opts = {
event: 'active',
public: 'own',
private: 'own',
updatetitle: 0,
showtimes: 0,
marklast: true,
active: "clan",
modifier: 0,
unreadbadges: 1,
colortabs: 0,
channeltag: 1,
alwayswho: 0,
tabsonbottom: 0,
buffer: 500,
foo: 1
},
In other words, "event" messages go in to the "active" tab.
That's exactly what we do now. Of course, we do have an Events tab. We could put System Messages there as well as in the active tab. Or, as I posed, we could broadcast them to all tabs, just as we do for other Events.
As of now, our behavior should match that of mchat, which I think is acceptable. BUt I'm thinking that putting System Messages ALSO into Events would be a good idea, so you could go look at them later without having to remember which tab you were in when they arrived.