martynsmith / node-irc

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

rpl_topicwhotime (333) nick parsing #379

Open kegsay opened 9 years ago

kegsay commented 9 years ago

This rpl doesn't seem to be parsed correctly. On Freenode, it produces the full prefix as in mynick!~myuser@mydomain.com instead of mynick. The following regex parses this correctly:

https://github.com/martynsmith/node-irc/blob/master/lib/parse_message.js#L26

But this doesn't seem to be getting called for this rpl. Easy to test by just setting a topic on Freenode.

sim642 commented 9 years ago

The reason for this is that it's not supposed to be parsed. In a RPL_TOPICWHOTIME the server is the sender and the topic setter is merely an argument. node-irc parses senders with the code you linked but there's nothing to parse arguments because they could be anything.

You can simply copy that hostmask parsing code and apply it onto the argument by hand.

kegsay commented 9 years ago

The reason for this is that it's not supposed to be parsed.

Says who? Given 333 has well defined arguments, we know which one the nick is. To not parse this because it's an argument is crazy.

sim642 commented 9 years ago

What I mean is that the current code isn't supposed to parse masks in arguments and there is no existing machinery to selectively do and return that. Also I'm not so sure about the well-defined part as UnrealIRCd only has nick in that argument.