Hide replies to our own internal WHO commands

References: https://todo.sr.ht/~emersion/gamja/88
This commit is contained in:
Simon Ser 2024-04-17 23:37:47 +02:00
parent 1ea7c30744
commit 269e034581
2 changed files with 12 additions and 1 deletions

View file

@ -849,6 +849,12 @@ export default class App extends Component {
let client = this.clients.get(serverID);
let chatHistoryBatch = irc.findBatchByType(msg, "chathistory");
// Reply triggered by some command sent by us, not worth displaying to
// the user
if (msg.internal) {
return [];
}
let target, channel, affectedBuffers;
switch (msg.command) {
case "MODE":

View file

@ -531,16 +531,19 @@ export default class Client extends EventTarget {
return this.roundtrip(msg, (msg) => {
switch (msg.command) {
case irc.RPL_WHOREPLY:
msg.internal = true;
l.push(this.parseWhoReply(msg));
break;
case irc.RPL_WHOSPCRPL:
if (msg.params.length !== fields.length + 1 || msg.params[1] !== token) {
break;
}
msg.internal = true;
l.push(this.parseWhoReply(msg));
break;
case irc.RPL_ENDOFWHO:
if (msg.params[1] === mask) {
msg.internal = true;
return l;
}
break;
@ -824,7 +827,9 @@ export default class Client extends EventTarget {
this.removeEventListener("status", handleStatus);
};
this.addEventListener("message", handleMessage);
// Turn on capture to handle messages before external users and
// have the opportunity to set the "internal" flag
this.addEventListener("message", handleMessage, { capture: true });
this.addEventListener("status", handleStatus);
this.send(msg);
});