freenode / jbnc

IRC Bouncer with no registration/setup required written in nodejs with support for separate client buffers and always-on.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to solve a problem with "irc-framework" of kiwiirc

Madriix opened this issue · comments

Hi
On JBNC there is all this currently:

          if(data[1]=="CAP") {
            if(data[3] && data[3]=='LS') {
              if(lines[n].trim().indexOf("cap-notify")>=0) {
                this.write("CAP REQ :cap-notify\n");
              }
              if(lines[n].trim().indexOf("away-notify")>=0) {
                this.write("CAP REQ :away-notify\n");
              }
              if(lines[n].trim().indexOf("invite-notify")>=0) {
                this.write("CAP REQ :invite-notify\n");
              }
              if(lines[n].trim().indexOf("extended-join")>=0) {
                this.write("CAP REQ :extended-join\n");
              }
              if(lines[n].trim().indexOf("userhost-in-names")>=0) {
                this.write("CAP REQ :userhost-in-names\n");
                this.userhostInNames=true;
              }
              if(lines[n].trim().indexOf("multi-prefix")>=0) {
                this.write("CAP REQ :multi-prefix\n");
              }
              if(lines[n].trim().indexOf("account-notify")>=0) {
                this.write("CAP REQ :account-notify\n");
              }
              if(lines[n].trim().indexOf("message-tags")>=0) {
                this.write("CAP REQ :message-tags\n");
                this.messagetags=true;
              }
              if(lines[n].trim().indexOf("account-tag")>=0) {
                this.write("CAP REQ :account-tag\n");
              }
              if(this.messagetags && lines[n].trim().indexOf("server-time")>=0) {
                this.write("CAP REQ :server-time\n");
              }
              if(lines[n].trim().indexOf("sasl")>=0) {
                this.write("CAP REQ :sasl\n");
                this.sasl=true;
              }
              if (!this.sasl)
                this.write("CAP END\n");
            }
            else if(this.sasl && data[3] && data[3]=='ACK') {
              if(lines[n].trim().indexOf("sasl")>=0) {
                this.write("AUTHENTICATE :PLAIN\n");
              }
            }
            else {
              if (!this.sasl)
                this.write("CAP END\n");
            }
            continue;
          }

I found a problem here:
https://github.com/kiwiirc/irc-framework/blob/469cbe7b2129ddae0328a7efe91eb218257e98ff/src/commands/handlers/channel.js#L218

handler.network.cap.isEnabled('extended-join')
this line always returns "false"
even for this one (the line 226):
data.gecos = command.params[gecos_idx] || '';
which can be tested for debug with:
data.gecos = command.params[gecos_idx]+" - test:"+handler.network.cap.isEnabled('sasl') || '';

it returns false all the time, when it should return true
It should be noted that jbnc recognizes well that it is connected by sasl, and it also detects the raws of the "extended-join" but on ircframework it always detects false for the "isEnabled", the problem could come from where ? Jbnc or irc-framework?
Something must be missing but i don't know where

also on you can remove the "if" https://github.com/kiwiirc/irc-framework/blob/469cbe7b2129ddae0328a7efe91eb218257e98ff/src/commands/handlers/channel.js#L218 like this:

        //if (handler.network.cap.isEnabled('extended-join')) {
            data.account = command.params[1] === '*' ? false : command.params[1];
            gecos_idx = 2;
        //}

and there the "data.gecos" works well, it is displayed correctly, the problem comes from the "handler.network.cap.isEnabled" which detects no active cap