2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-09-13 21:29:45 +00:00
|
|
|
module.exports = function(irc, network) {
|
2017-07-11 14:40:43 +00:00
|
|
|
const client = this;
|
|
|
|
|
2016-03-07 21:09:42 +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);
|
|
|
|
newUser.setModes(user.modes, network.prefixLookup);
|
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
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|