2016-10-09 21:14:02 +02:00
|
|
|
"use strict";
|
|
|
|
|
2014-09-13 23:29:45 +02:00
|
|
|
module.exports = function(irc, network) {
|
2017-07-11 16:40:43 +02:00
|
|
|
const client = this;
|
|
|
|
|
2016-03-07 22:09:42 +01:00
|
|
|
irc.on("userlist", function(data) {
|
2017-07-11 16:40:43 +02:00
|
|
|
const chan = network.getChannel(data.channel);
|
2018-02-20 08:28:04 +01:00
|
|
|
|
2014-09-13 23:29:45 +02:00
|
|
|
if (typeof chan === "undefined") {
|
|
|
|
return;
|
|
|
|
}
|
2016-09-24 18:34:35 +02:00
|
|
|
|
2017-11-16 21:32:03 +01:00
|
|
|
const newUsers = new Map();
|
2017-07-11 16:40:43 +02:00
|
|
|
|
2017-11-16 21:32:03 +01:00
|
|
|
data.users.forEach((user) => {
|
|
|
|
const newUser = chan.getUser(user.nick);
|
|
|
|
newUser.setModes(user.modes, network.prefixLookup);
|
2017-07-11 16:40:43 +02:00
|
|
|
|
2017-11-16 21:32:03 +01:00
|
|
|
newUsers.set(user.nick.toLowerCase(), newUser);
|
2017-07-11 16:40:43 +02:00
|
|
|
});
|
2016-09-24 18:34:35 +02:00
|
|
|
|
2017-11-16 21:32:03 +01:00
|
|
|
chan.users = newUsers;
|
2016-09-24 18:34:35 +02:00
|
|
|
|
2014-09-13 23:29:45 +02:00
|
|
|
client.emit("users", {
|
2017-11-15 07:35:15 +01:00
|
|
|
chan: chan.id,
|
2014-09-13 23:29:45 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|