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); let members = new irc.CaseMapMap(buf.members);
members.delete(msg.prefix.name); members.delete(msg.prefix.name);
let offline = client.cm(buf.name) === client.cm(msg.prefix.name); buffers.set(buf.id, { ...buf, members });
buffers.set(buf.id, { ...buf, members, offline });
affectedBuffers.push(buf.name); affectedBuffers.push(buf.name);
}); });
return { buffers }; return { buffers };

View file

@ -419,6 +419,25 @@ export const State = {
members.delete(nick); members.delete(nick);
return { members }; 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": case "SETNAME":
return updateUser(msg.prefix.name, { realname: msg.params[0] }); return updateUser(msg.prefix.name, { realname: msg.params[0] });
case "CHGHOST": case "CHGHOST":