mirror of
https://git.sr.ht/~emersion/gamja
synced 2024-11-28 18:45:51 -05:00
Update user on QUIT and NICK
This commit is contained in:
parent
c66ce61029
commit
ecb2ee041b
2 changed files with 20 additions and 2 deletions
|
@ -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 };
|
||||||
|
|
19
state.js
19
state.js
|
@ -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":
|
||||||
|
|
Loading…
Reference in a new issue