hardlounge/src/plugins/irc-events/names.js

22 lines
408 B
JavaScript
Raw Normal View History

"use strict";
2014-09-13 17:29:45 -04:00
var User = require("../../models/user");
module.exports = function(irc, network) {
var client = this;
irc.on("userlist", function(data) {
2016-03-20 10:28:47 -04:00
var chan = network.getChannel(data.channel);
2014-09-13 17:29:45 -04:00
if (typeof chan === "undefined") {
return;
}
chan.users = data.users.map(u => new User(u, network.prefixLookup));
chan.sortUsers(irc);
2014-09-13 17:29:45 -04:00
client.emit("users", {
chan: chan.id
2014-09-13 17:29:45 -04:00
});
});
};