~emersion/gamja

bc05fd5c116638943dec372e2dadeb10c5d41109 — Simon Ser 13 hours ago 095006e master
Treat server broadcasts as highlights
2 files changed, 10 insertions(+), 1 deletions(-)

M components/app.js
M lib/irc.js
M components/app.js => components/app.js +3 -1
@@ 349,7 349,9 @@ export default class App extends Component {
	addMessage(serverID, bufName, msg) {
		let client = this.clients.get(serverID);

		msg.isHighlight = irc.isHighlight(msg, client.nick, client.cm);
		// Treat server-wide broadcasts as highlights. They're sent by server
		// operators and can contain important information.
		msg.isHighlight = irc.isHighlight(msg, client.nick, client.cm) || irc.isServerBroadcast(msg);

		if (!msg.tags) {
			msg.tags = {};

M lib/irc.js => lib/irc.js +7 -0
@@ 288,6 288,13 @@ export function isHighlight(msg, nick, cm) {
	}
}

export function isServerBroadcast(msg) {
	if (msg.command != "PRIVMSG" && msg.command != "NOTICE") {
		return false;
	}
	return msg.params[0].startsWith("$");
}

export function isError(cmd) {
	if (cmd >= "400" && cmd <= "568") {
		return true;