Store WHO list in RPL_ENDOFWHO

This allows the state-tracker to figure out whether a WHO query
returned no result.
This commit is contained in:
Simon Ser 2021-11-10 10:32:23 +01:00
parent c11bf6508a
commit 55361c5a2b
2 changed files with 8 additions and 6 deletions

View file

@ -303,6 +303,13 @@ export default class Client extends EventTarget {
case irc.RPL_ENDOFWHOIS: case irc.RPL_ENDOFWHOIS:
this.endPendingList("WHOIS " + msg.params[1], msg); this.endPendingList("WHOIS " + msg.params[1], msg);
break; break;
case irc.RPL_WHOREPLY:
case irc.RPL_WHOSPCRPL:
this.pushPendingList("WHO", msg);
break;
case irc.RPL_ENDOFWHO:
this.endPendingList("WHO", msg);
break;
case irc.ERR_NICKLOCKED: case irc.ERR_NICKLOCKED:
case irc.ERR_SASLFAIL: case irc.ERR_SASLFAIL:
case irc.ERR_SASLTOOLONG: case irc.ERR_SASLTOOLONG:

View file

@ -384,14 +384,9 @@ export const State = {
return updateUser(who.nick, who); return updateUser(who.nick, who);
case irc.RPL_ENDOFWHO: case irc.RPL_ENDOFWHO:
target = msg.params[1]; target = msg.params[1];
if (!client.isChannel(target) && target.indexOf("*") < 0) { if (msg.list.length == 0 && !client.isChannel(target) && target.indexOf("*") < 0) {
// Not a channel nor a mask, likely a nick // Not a channel nor a mask, likely a nick
return updateUser(target, (user) => { return updateUser(target, (user) => {
// TODO: mark user offline if we have old WHO info but this
// WHO reply is empty
if (user) {
return;
}
return { offline: true }; return { offline: true };
}); });
} }