martynsmith / node-irc

NodeJS IRC client library
GNU General Public License v3.0
1.33k stars 424 forks source link

Allow tilde in nicks #438

Closed hexjelly closed 8 years ago

hexjelly commented 8 years ago

Ran into an issue with the message handler returning the "from" variable (nick) as undefined. Noticed the regex does not allow the tilde characters in nicks.

del6597 commented 8 years ago

As far as I know and what RFC 2812 specifies, tilde (~) is not a valid character for a nickname. Is this possibly an issue with prefixchars (~&@%+) on nicknames in a channel?

hexjelly commented 8 years ago

Maybe it's not too prevalent then, I'm not super familiar with the RFC or what server specific stuff there are. I just know on the network I'm using it's allowed; IRCNet.

jirwin commented 8 years ago

I agree with @del6597 on this one. Are you sure the ~ character isn't just the prefix of the nick?

@hexjelly Can you include the output of the error you are seeing?

hexjelly commented 8 years ago

Yes I am certain. There is no error, you will just get undefined if you try to use the returned 'message.nick' variable anywhere, as the regex won't match. So anything that uses the parseMessage function. You can follow the RFC, but at least the module will not work properly for anyone that uses the IRCNet network, well for nicks with a tilde in them anyway :) Again, maybe it's the only network out there that doesn't follow the RFC's nick restrictions for all I know though. Though unlikely?

Still, would it not be saner to just have a more open regex to match anything followed by !@ as the source, and let the server decide what it can/will use instead?

del6597 commented 8 years ago

I just took a look at IRCNets software changelogs.

This is version 2.11.1 of the IRC software.
===============================================================================

New features in 2.11.1:
    * Clients can use '~' char in nicknames.
jirwin commented 8 years ago

@del6597 Thanks for finding that.

@hexjelly You're right. It won't hurt anything to add it.