lib/irc: add missing Isupport.chanModes

It was called by forEachChannelModeUpdate, but wasn't implemented.
This commit is contained in:
Simon Ser 2022-01-31 18:24:34 +01:00
parent 393fd93253
commit bd48f36ade

View file

@ -73,7 +73,6 @@ export const ERR_SASLALREADY = "907";
export const STD_MEMBERSHIPS = "~&@%+";
export const STD_CHANTYPES = "#&+!";
export const STD_CHANMODES = "beI,k,l,imnst";
const tagEscapeMap = {
";": "\\:",
@ -464,6 +463,19 @@ export class Isupport {
bouncerNetID() {
return this.raw.get("BOUNCER_NETID");
}
chanModes() {
const stdChanModes = ["beI", "k", "l", "imnst"];
if (!this.raw.has("CHANMODES")) {
return stdChanModes;
}
let chanModes = this.raw.get("CHANMODES").split(",");
if (chanModes.length != 4) {
console.error("Invalid CHANMODES: ", this.raw.get("CHANMODES"));
return stdChanModes;
}
return chanModes;
}
}
export const CaseMapping = {
@ -672,11 +684,10 @@ export function getMessageLabel(msg) {
}
export function forEachChannelModeUpdate(msg, isupport, callback) {
let chanmodes = isupport.chanModes();
let [a, b, c, d] = isupport.chanModes();
let prefix = isupport.prefix();
let typeByMode = new Map();
let [a, b, c, d] = chanmodes.split(",");
Array.from(a).forEach((mode) => typeByMode.set(mode, "A"));
Array.from(b).forEach((mode) => typeByMode.set(mode, "B"));
Array.from(c).forEach((mode) => typeByMode.set(mode, "C"));