irc-framework icon indicating copy to clipboard operation
irc-framework copied to clipboard

Problem with the handler.network.cap.isEnabled(...) it always returns false even if enabled

Open Madriix opened this issue 3 years ago • 1 comments

Hi

On https://github.com/kiwiirc/irc-framework/blob/master/src/commands/handlers/channel.js#L218 there is code like handler.network.cap.isEnabled('extended-join') and I found that it returns false all the time from a bnc created in JavaScript with nodejs, whereas yet on this bnc the extended-join is enabled. There is also handler.network.cap.isEnabled('sasl') which returns false, yet it is enabled on the BNC connecting to irc-framework. Where could the problem come from?

The idea I had was to change this:

    JOIN: function(command, handler) {
        let channel;
        let gecos_idx = 1;
        const data = {};

        if (typeof command.params[0] === 'string' && command.params[0] !== '') {
            channel = command.params[0];
        }

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

        data.nick = command.nick;
        data.ident = command.ident;
        data.hostname = command.hostname;
        data.gecos = command.params[gecos_idx] || '';
        data.channel = channel;
        data.time = command.getServerTime();
        data.tags = command.tags;
        data.batch = command.batch;
        handler.emit('join', data);
    },

by

    JOIN: function(command, handler) {
        let channel;
        let gecos_idx = 1;
        const data = {};

        if (typeof command.params[0] === 'string' && command.params[0] !== '') {
            channel = command.params[0];
        }

//changed
            data.account = command.params[1] === '*' ? false : command.params[1];
            gecos_idx = 2;
        

        data.nick = command.nick;
        data.ident = command.ident;
        data.hostname = command.hostname;
        data.gecos = command.params[gecos_idx] || '';
        data.channel = channel;
        data.time = command.getServerTime();
        data.tags = command.tags;
        data.batch = command.batch;
        handler.emit('join', data);
    },

It works fine now, but I would have liked the if ( handler.network.cap.isEnabled(...) ) to work properly

I use JBNC to connect to irc-framework: https://github.com/freenode/jbnc/issues/62 having activated the extended-join cap successfully but irc-framework recognizes that it is false with handler.network.cap.isEnabled(...)

Madriix avatar Jul 23 '22 05:07 Madriix

client.requestCap('your/cap');

hope that helps

ItsOnlyBinary avatar Jul 23 '22 08:07 ItsOnlyBinary