Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/parse_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ module.exports = function parseMessage(line, stripColors) {
if (match) {
message.prefix = match[1];
line = line.replace(/^:[^ ]+ +/, '');
match = message.prefix.match(/^([_a-zA-Z0-9\[\]\\`^{}|-]*)(!([^@]+)@(.*))?$/);

// Allow . (dot), : (colon) and / (slash) in the nickname for compatibility
// with certain substandard IRC implementations (like the PSYC's built-in IRC gate).
// However, only allow those characters when we are sure that we are not taking
// a server hostname for a nick (otherwise any server hostname would get misparsed
// as a nick without !user@host).

match = message.prefix.match(/^([_a-zA-Z0-9\[\]\\`^{}|-]*)(!([^@]+)@(.*))?$/) ||
message.prefix.match(/^([_a-zA-Z0-9\[\]\\`^{}|:./-]*)(!([^@]+)@(.*))$/);
if (match) {
message.nick = match[1];
message.user = match[3];
Expand Down