2022-06-19 00:25:21 +00:00
|
|
|
import {IrcEventHandler} from "../../client";
|
2016-10-09 19:14:02 +00:00
|
|
|
|
2022-06-19 00:25:21 +00:00
|
|
|
export default <IrcEventHandler>function (irc, network) {
|
2017-07-11 14:40:43 +00:00
|
|
|
const client = this;
|
|
|
|
|
2020-03-21 20:55:36 +00:00
|
|
|
irc.on("userlist", function (data) {
|
2017-07-11 14:40:43 +00:00
|
|
|
const chan = network.getChannel(data.channel);
|
2018-02-20 07:28:04 +00:00
|
|
|
|
2014-09-13 21:29:45 +00:00
|
|
|
if (typeof chan === "undefined") {
|
|
|
|
return;
|
|
|
|
}
|
2016-09-24 16:34:35 +00:00
|
|
|
|
2017-11-16 20:32:03 +00:00
|
|
|
const newUsers = new Map();
|
2017-07-11 14:40:43 +00:00
|
|
|
|
2017-11-16 20:32:03 +00:00
|
|
|
data.users.forEach((user) => {
|
|
|
|
const newUser = chan.getUser(user.nick);
|
2021-07-21 07:30:07 +00:00
|
|
|
newUser.setModes(user.modes, network.serverOptions.PREFIX);
|
2017-07-11 14:40:43 +00:00
|
|
|
|
2017-11-16 20:32:03 +00:00
|
|
|
newUsers.set(user.nick.toLowerCase(), newUser);
|
2017-07-11 14:40:43 +00:00
|
|
|
});
|
2016-09-24 16:34:35 +00:00
|
|
|
|
2017-11-16 20:32:03 +00:00
|
|
|
chan.users = newUsers;
|
2016-09-24 16:34:35 +00:00
|
|
|
|
2014-09-13 21:29:45 +00:00
|
|
|
client.emit("users", {
|
2017-11-15 06:35:15 +00:00
|
|
|
chan: chan.id,
|
2014-09-13 21:29:45 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|