]> jfr.im git - irc/evilnet/node-irc-nefarious.git/commitdiff
Reset modes before iterating on args
authorHalf-Shot <redacted>
Tue, 25 Jul 2023 16:04:07 +0000 (17:04 +0100)
committerHalf-Shot <redacted>
Tue, 25 Jul 2023 16:04:07 +0000 (17:04 +0100)
src/irc.ts

index c5780e76c9b482f20fdcbeece8088391c1c18c23..135933aed1eee362af24fcdf169285b3d11a314f 100644 (file)
@@ -355,8 +355,14 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter<C
     }
 
     private onReplyISupport(message: Message) {
+
         // Clear extras
         this.state.supportedState.extra = [];
+        // Clear modes
+        this.state.supportedState.channel.modes = {
+            a:'', b:'', c:'', d:''
+        };
+
         message.args.forEach((arg) => {
             let match;
             match = arg.match(/([A-Z]+)=(.*)/);
@@ -380,9 +386,6 @@ export class Client extends (EventEmitter as unknown as new () => TypedEmitter<C
                 case 'CHANMODES': {
                     const values = value.split(',');
                     const type: ['a', 'b', 'c', 'd'] = ['a', 'b', 'c', 'd'];
-                    this.state.supportedState.channel.modes = {
-                        a:'', b:'', c:'', d:''
-                    };
                     for (let i = 0; i < type.length; i++) {
                         this.state.supportedState.channel.modes[type[i]] += values[i];
                     }