Merge pull request #1758 from MaxLeiter/improve-regex

update nick regex for linking nicks in text
This commit is contained in:
Jérémie Astori 2017-11-27 18:30:37 -05:00 committed by GitHub
commit 7daf566025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,7 @@ const Chan = require("../../models/chan");
const Msg = require("../../models/msg");
const LinkPrefetch = require("./link");
const cleanIrcMessage = require("../../../client/js/libs/handlebars/ircmessageparser/cleanIrcMessage");
const nickRegExp = /[\w[\]\\`^{|}-]{4,}/gi;
const nickRegExp = /(?:\x03[0-9]{1,2}(?:,[0-9]{1,2})?)?([\w[\]\\`^{|}-]{4,})/g;
module.exports = function(irc, network) {
const client = this;
@ -92,8 +92,8 @@ module.exports = function(irc, network) {
const users = [];
let match;
while ((match = nickRegExp.exec(data.message))) {
if (chan.findUser(match[0])) {
users.push(match[0]);
if (chan.findUser(match[1])) {
users.push(match[1]);
}
}