mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-14 19:05:01 -05:00
Hide replies to our own internal WHO commands
References: https://todo.sr.ht/~emersion/gamja/88
This commit is contained in:
parent
1ea7c30744
commit
269e034581
2 changed files with 12 additions and 1 deletions
|
@ -849,6 +849,12 @@ export default class App extends Component {
|
||||||
let client = this.clients.get(serverID);
|
let client = this.clients.get(serverID);
|
||||||
let chatHistoryBatch = irc.findBatchByType(msg, "chathistory");
|
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;
|
let target, channel, affectedBuffers;
|
||||||
switch (msg.command) {
|
switch (msg.command) {
|
||||||
case "MODE":
|
case "MODE":
|
||||||
|
|
|
@ -531,16 +531,19 @@ export default class Client extends EventTarget {
|
||||||
return this.roundtrip(msg, (msg) => {
|
return this.roundtrip(msg, (msg) => {
|
||||||
switch (msg.command) {
|
switch (msg.command) {
|
||||||
case irc.RPL_WHOREPLY:
|
case irc.RPL_WHOREPLY:
|
||||||
|
msg.internal = true;
|
||||||
l.push(this.parseWhoReply(msg));
|
l.push(this.parseWhoReply(msg));
|
||||||
break;
|
break;
|
||||||
case irc.RPL_WHOSPCRPL:
|
case irc.RPL_WHOSPCRPL:
|
||||||
if (msg.params.length !== fields.length + 1 || msg.params[1] !== token) {
|
if (msg.params.length !== fields.length + 1 || msg.params[1] !== token) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
msg.internal = true;
|
||||||
l.push(this.parseWhoReply(msg));
|
l.push(this.parseWhoReply(msg));
|
||||||
break;
|
break;
|
||||||
case irc.RPL_ENDOFWHO:
|
case irc.RPL_ENDOFWHO:
|
||||||
if (msg.params[1] === mask) {
|
if (msg.params[1] === mask) {
|
||||||
|
msg.internal = true;
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -824,7 +827,9 @@ export default class Client extends EventTarget {
|
||||||
this.removeEventListener("status", handleStatus);
|
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.addEventListener("status", handleStatus);
|
||||||
this.send(msg);
|
this.send(msg);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue