Update user on QUIT and NICK

This commit is contained in:
Simon Ser 2021-09-21 14:00:52 +02:00
parent c66ce61029
commit ecb2ee041b
2 changed files with 20 additions and 2 deletions

View file

@ -675,8 +675,7 @@ export default class App extends Component {
}
let members = new irc.CaseMapMap(buf.members);
members.delete(msg.prefix.name);
let offline = client.cm(buf.name) === client.cm(msg.prefix.name);
buffers.set(buf.id, { ...buf, members, offline });
buffers.set(buf.id, { ...buf, members });
affectedBuffers.push(buf.name);
});
return { buffers };

View file

@ -419,6 +419,25 @@ export const State = {
members.delete(nick);
return { members };
});
case "QUIT":
return updateUser(msg.prefix.name, (user) => {
if (!user) {
return;
}
return { offline: true };
});
case "NICK":
let newNick = msg.params[0];
return updateServer((server) => {
let users = new irc.CaseMapMap(server.users);
let user = users.get(msg.prefix.name);
if (!user) {
return;
}
users.set(newNick, user);
users.delete(msg.prefix.name);
return { users };
});
case "SETNAME":
return updateUser(msg.prefix.name, { realname: msg.params[0] });
case "CHGHOST":