diff --git a/components/app.js b/components/app.js index 51b6e0b..dcd1dfd 100644 --- a/components/app.js +++ b/components/app.js @@ -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": diff --git a/lib/client.js b/lib/client.js index b89419a..f94f0e6 100644 --- a/lib/client.js +++ b/lib/client.js @@ -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); });