martynsmith/node-irc — Issue #39: Channel letter-case crashes client
Author: Acubed
Created: 2011-10-22 03:33:04+00:00
State: open

Commit 549d62f09974ef92c2aa5f1183d38e26e3ee12a0 introduced a bug where channels with uppercase letters will crash the client because the channel name is, for example, #Node.js as returned by Freenode, but stored as #node.js. While JOIN, PART, and KICK operations don't trigger a crash, any other command that looksup the channel by name does, like in this case a channel mode:

node_modules/irc/lib/irc.js:913
throw err;
^
TypeError: Cannot read property 'users' of undefined
at Client. (node_modules/irc/lib/irc.js:611:40)
at Client.emit (events.js:88:20)
at node_modules/irc/lib/irc.js:910:22
at Array.forEach (native)
at Socket. (node_modules/irc/lib/irc.js:907:15)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:302:31)

Reverting the above commit fixes any crashing (which I don't fully understand, since it says it was supposed to _fix_ such crashes).

The client should assume that the particular case the IRC server uses is meaningful, so if it changes the case on us we should adopt that case instead.