mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-02 22:43:19 +02:00
8fcd079204
* properly track user modes for context menu The RPL_ISUPPORT response contains a PREFIX element, which not only tracks the prefix chars ("@", "+" etc) but also their corresponding mode chars (+O, +v) This commit changes the context menu to not rely on a hardcoded list but rather user the one given in the prefix response by the server. Co-authored-by: Max Leiter <maxwell.leiter@gmail.com>
29 lines
535 B
JavaScript
29 lines
535 B
JavaScript
"use strict";
|
|
|
|
module.exports = 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,
|
|
});
|
|
});
|
|
};
|