Permalink
Browse files

Fixed sending messages that start with a :

  • Loading branch information...
martynsmith committed Jan 10, 2013
1 parent 73fea61 commit 2faf5a5f68cdd37832e47a6ac8758a718e62b972
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/irc.js
View
@@ -689,7 +689,7 @@ Client.prototype.send = function(command) { // {{{
// Note that the command arg is included in the args array as the first element
- if ( args[args.length-1].match(/\s/) ) {
+ if ( args[args.length-1].match(/\s/) || args[args.length-1].match(/^:/) ) {
args[args.length-1] = ":" + args[args.length-1];
}

4 comments on commit 2faf5a5

@damianb

This comment has been minimized.

Show comment Hide comment
@damianb

damianb Jan 10, 2013

Contributor

Will this also fix messages that just contain a :? I remember seeing odd behavior when someone used a :) in the channel with my bot.

EDIT: Nope, doesn't seem to.

bot's output to console.log (based on the message text parsed out)

<Katana> :something

actual message:

<Katana> something something :)
Contributor

damianb replied Jan 10, 2013

Will this also fix messages that just contain a :? I remember seeing odd behavior when someone used a :) in the channel with my bot.

EDIT: Nope, doesn't seem to.

bot's output to console.log (based on the message text parsed out)

<Katana> :something

actual message:

<Katana> something something :)
@ikrabbe

This comment has been minimized.

Show comment Hide comment
@ikrabbe

ikrabbe Jan 14, 2013

This problem seems to be related to receiving messages, but sending messages.
What's the general idea of the colon prefix anyway? Looks as if this introduces more problems then solutions.

This problem seems to be related to receiving messages, but sending messages.
What's the general idea of the colon prefix anyway? Looks as if this introduces more problems then solutions.

@quentinxs

This comment has been minimized.

Show comment Hide comment
@quentinxs

quentinxs Jan 14, 2013

Contributor

The colon prefix is part of the IRC protocol. It indicates a message line as the last argument of various IRC commands

Contributor

quentinxs replied Jan 14, 2013

The colon prefix is part of the IRC protocol. It indicates a message line as the last argument of various IRC commands

@ikrabbe

This comment has been minimized.

Show comment Hide comment
@ikrabbe

ikrabbe Jan 15, 2013

This implementation disturbs me: Client.send("CMD") gives: args[0]=":CMD"; which looks quite wrong.
as send is a RAW protocol, we should better leave all arguments as is. Error checking should be left to the user of the api.
Even more error prone seems to be the implementation of parseMessage... I think it would be better to simply scan the line once by a state machine, but match the line and parts of it with several regular expressions.
Maybe I write a version tomorrow.

This implementation disturbs me: Client.send("CMD") gives: args[0]=":CMD"; which looks quite wrong.
as send is a RAW protocol, we should better leave all arguments as is. Error checking should be left to the user of the api.
Even more error prone seems to be the implementation of parseMessage... I think it would be better to simply scan the line once by a state machine, but match the line and parts of it with several regular expressions.
Maybe I write a version tomorrow.

Please sign in to comment.