mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 22:10:22 +00:00
dd05ee3a65
Co-authored-by: Eric Nemchik <eric@nemchik.com> Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
28 lines
582 B
TypeScript
28 lines
582 B
TypeScript
import {IrcEventHandler} from "../../client";
|
|
|
|
export default <IrcEventHandler>function (irc, network) {
|
|
const client = this;
|
|
|
|
irc.on("userlist", function (data) {
|
|
const chan = network.getChannel(data.channel);
|
|
|
|
if (typeof chan === "undefined") {
|
|
return;
|
|
}
|
|
|
|
const newUsers = new Map();
|
|
|
|
data.users.forEach((user) => {
|
|
const newUser = chan.getUser(user.nick);
|
|
newUser.setModes(user.modes, network.serverOptions.PREFIX);
|
|
|
|
newUsers.set(user.nick.toLowerCase(), newUser);
|
|
});
|
|
|
|
chan.users = newUsers;
|
|
|
|
client.emit("users", {
|
|
chan: chan.id,
|
|
});
|
|
});
|
|
};
|