From 469766ae0b96f0f1ce606a702541fe7e99cc1bb8 Mon Sep 17 00:00:00 2001 From: Yuriy Peskov Date: Sun, 17 Sep 2017 16:09:34 +0300 Subject: [PATCH] Fix parsong of non-latin nicks --- lib/parse_message.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/parse_message.js b/lib/parse_message.js index 698c6388..ca945912 100644 --- a/lib/parse_message.js +++ b/lib/parse_message.js @@ -23,13 +23,18 @@ module.exports = function parseMessage(line, stripColors) { if (match) { message.prefix = match[1]; line = line.replace(/^:[^ ]+ +/, ''); - match = message.prefix.match(/^([_a-zA-Z0-9\~\[\]\\`^{}|-]*)(!([^@]+)@(.*))?$/); + match = message.prefix.match(/^(.*)!.*$/); + if (match) { message.nick = match[1]; + } + + match = message.prefix.match(/^([_a-zA-Z0-9\~\[\]\\`^{}|-]*)(!([^@]+)@(.*))?$/); + + if (match) { message.user = match[3]; message.host = match[4]; - } - else { + } else { message.server = message.prefix; } }