From bc05fd5c116638943dec372e2dadeb10c5d41109 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 23 Jun 2021 19:52:45 +0200 Subject: [PATCH] Treat server broadcasts as highlights --- components/app.js | 4 +++- lib/irc.js | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/app.js b/components/app.js index 050f712..54731d2 100644 --- a/components/app.js +++ b/components/app.js @@ -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 = {}; diff --git a/lib/irc.js b/lib/irc.js index e485140..b8cd16a 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -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;