Skip to content

If I send JSON containing a colon, the PRIVMSG to the server seems to lack a vital colon #581

Description

@CaiusJard

So I'm using this project to "say" blocks of json to the server, and I was having some issues with other clients, in-chan, seeing truncated messages. I tweaked the bot.js to perform a test with json:

image

Said hello to it:

image

When this particular message is sent by the bot it seems to lack the colon at the start, as reported by my ircd:

image

The code for my daemon seems to bin everything after the first colon hence the truncation..

I found this:

Client.prototype.send = function(command) {
    var args = Array.prototype.slice.call(arguments);

    // Note that the command arg is included in the args array as the first element

    if (args[args.length - 1].match(/\s/) || args[args.length - 1].match(/^:/) || args[args.length - 1] === '') {
        args[args.length - 1] = ':' + args[args.length - 1];
    }

    if (this.opt.debug)
        util.log('SEND: ' + args.join(' '));

    if (!this.conn.requestedDisconnect) {
        this.conn.write(args.join(' ') + '\r\n');
    }
};

it seems to mean:

If the message contains spaces, or if the message starts with a colon, or if there is no message, add a colon?

I note my json contains no spaces, nor does it start with a colon, nor is it empty..

Is this the bug? I also see problems if I write bot.say("hello:world")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions