state: simplify MONITOR reply handling

This commit is contained in:
Simon Ser 2023-08-25 13:09:14 +02:00
parent ffbbde7f28
commit 97b5970acb

View file

@ -645,21 +645,12 @@ export const State = {
return { members }; return { members };
}); });
case irc.RPL_MONONLINE: case irc.RPL_MONONLINE:
targets = msg.params[1].split(",");
for (let target of targets) {
let prefix = irc.parsePrefix(target);
let update = updateUser(prefix.name, { offline: false });
state = { ...state, ...update };
}
return state;
case irc.RPL_MONOFFLINE: case irc.RPL_MONOFFLINE:
targets = msg.params[1].split(","); targets = msg.params[1].split(",");
for (let target of targets) { for (let target of targets) {
let prefix = irc.parsePrefix(target); let prefix = irc.parsePrefix(target);
let update = updateUser(prefix.name, { offline: true }); let update = updateUser(prefix.name, { offline: msg.command == irc.RPL_MONOFFLINE });
state = { ...state, ...update }; state = { ...state, ...update };
} }