update nick regex for linking nicks in text

This commit is contained in:
Max Leiter 2017-11-27 13:58:10 -08:00
parent 3d31fa4686
commit f98deaba70

View File

@ -4,7 +4,7 @@ const Chan = require("../../models/chan");
const Msg = require("../../models/msg"); const Msg = require("../../models/msg");
const LinkPrefetch = require("./link"); const LinkPrefetch = require("./link");
const cleanIrcMessage = require("../../../client/js/libs/handlebars/ircmessageparser/cleanIrcMessage"); 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) { module.exports = function(irc, network) {
const client = this; const client = this;
@ -92,8 +92,8 @@ module.exports = function(irc, network) {
const users = []; const users = [];
let match; let match;
while ((match = nickRegExp.exec(data.message))) { while ((match = nickRegExp.exec(data.message))) {
if (chan.findUser(match[0])) { if (chan.findUser(match[1])) {
users.push(match[0]); users.push(match[1]);
} }
} }