From 89647472aed13291216deff2196cc7be4920406f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 22 Aug 2022 10:30:56 +0200 Subject: [PATCH] components/app: don't open buffer for CTCP messages These are usually completely uninteresting messages, e.g. CTCP VERSION or whatever. --- components/app.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/app.js b/components/app.js index d4a100d..b4485b8 100644 --- a/components/app.js +++ b/components/app.js @@ -750,8 +750,19 @@ export default class App extends Component { } } } - if (msg.command === "NOTICE" && !State.getBuffer(this.state, { server: serverID, name: target })) { - // Don't open a new buffer if this is just a NOTICE + + // Don't open a new buffer if this is just a NOTICE or a garbage + // CTCP message + let openNewBuffer = true; + if (msg.command !== "PRIVMSG") { + openNewBuffer = false; + } else { + let ctcp = irc.parseCTCP(msg); + if (ctcp && ctcp.command !== "ACTION") { + openNewBuffer = false; + } + } + if (!openNewBuffer && !State.getBuffer(this.state, { server: serverID, name: target })) { target = SERVER_BUFFER; }