components/app: don't open buffer for CTCP messages

These are usually completely uninteresting messages, e.g. CTCP
VERSION or whatever.
This commit is contained in:
Simon Ser 2022-08-22 10:30:56 +02:00
parent e2dc32c0d3
commit 89647472ae

View File

@ -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;
}