maybe fix channel permissions

This commit is contained in:
zefie
2025-06-20 05:35:23 -04:00
parent e52826482a
commit 91ef60996a

View File

@@ -3877,7 +3877,11 @@ class WTVIRC {
return false; return false;
} }
if (mode === '+o' || mode === '-o') { if (mode === '+o' || mode === '-o') {
var channelOps = this.channelops.get(channel) || new Set(); var channelOps = this.channelops.get(channel);
if (!channelOps || channelOps === true) {
this.channelops.set(channel, new Set());
channelOps = this.channelops.get(channel);
}
if (channelOps === true) { if (channelOps === true) {
channelOps = new Set(); channelOps = new Set();
} }
@@ -3893,10 +3897,12 @@ class WTVIRC {
} }
} }
} else if (mode === '+h' || mode === '-h') { } else if (mode === '+h' || mode === '-h') {
var channelHalfOps = this.channelhalfops.get(channel) || new Set(); var channelHalfOps = this.channelhalfops.get(channel);
if (channelHalfOps === true) { if (!channelHalfOps || channelHalfOps === true) {
channelHalfOps = new Set(); this.channelhalfops.set(channel, new Set());
channelHalfOps = this.channelhalfops.get(channel);
} }
if (mode === '+h') { if (mode === '+h') {
if (!channelHalfOps.has(target)) { if (!channelHalfOps.has(target)) {
channelHalfOps.add(target); channelHalfOps.add(target);
@@ -3909,9 +3915,10 @@ class WTVIRC {
} }
} }
} else if (mode === '+v' || mode === '-v') { } else if (mode === '+v' || mode === '-v') {
var channelVoices = this.channelvoices.get(channel) || new Set(); var channelVoices = this.channelvoices.get(channel);
if (channelVoices === true) { if (!channelVoices || channelVoices === true) {
channelVoices = new Set(); this.channelvoices.set(channel, new Set());
channelVoices = this.channelvoices.get(channel);
} }
if (mode === '+v') { if (mode === '+v') {
if (!channelVoices.has(target)) { if (!channelVoices.has(target)) {
@@ -3925,9 +3932,10 @@ class WTVIRC {
} }
} }
} else if (mode === '+b' || mode === '-b') { } else if (mode === '+b' || mode === '-b') {
var channelBans = this.channelbans.get(channel) || []; var channelBans = this.channelbans.get(channel);
if (channelBans === true) { if (!channelBans || channelBans === true) {
channelBans = []; this.channelbans.set(channel, []);
channelBans = this.channelbans.get(channel);
} }
if (mode === '+b') { if (mode === '+b') {
if (!channelBans.includes(target)) { if (!channelBans.includes(target)) {
@@ -3941,9 +3949,10 @@ class WTVIRC {
} }
} }
} else if (mode === '+e' || mode === '-e') { } else if (mode === '+e' || mode === '-e') {
var channelExemptions = this.channelexemptions.get(channel) || []; var channelExemptions = this.channelexemptions.get(channel);
if (channelExemptions === true) { if (!channelExemptions || channelExemptions === true) {
channelExemptions = []; this.channelexemptions.set(channel, []);
channelExemptions = this.channelexemptions.get(channel);
} }
if (mode === '+e') { if (mode === '+e') {
if (!channelExemptions.includes(target)) { if (!channelExemptions.includes(target)) {
@@ -3957,9 +3966,10 @@ class WTVIRC {
} }
} }
} else if (mode === '+I' || mode === '-I') { } else if (mode === '+I' || mode === '-I') {
var channelInvites = this.channelinvites.get(channel) || []; var channelInvites = this.channelinvites.get(channel)
if (channelInvites === true) { if (!channelInvites || channelInvites === true) {
channelInvites = []; this.channelinvites.set(channel, []);
channelInvites = this.channelinvites.get(channel);
} }
if (mode === '+I') { if (mode === '+I') {
if (!channelInvites.includes(target)) { if (!channelInvites.includes(target)) {