From: Jack Allnutt Date: Sat, 17 Sep 2011 16:30:01 +0000 (+0100) Subject: Apply channel linking before colour linking so colours aren't interpreted as channels X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9d34a1ca0e87e3525e12208436a2d54b65974bd1;p=KiwiIRC.git Apply channel linking before colour linking so colours aren't interpreted as channels --- diff --git a/js/front.js b/js/front.js index e0c107f..b699f7c 100644 --- a/js/front.js +++ b/js/front.js @@ -1242,6 +1242,10 @@ kiwi.front = { format: function (msg) { var re; + if ((!msg) || (typeof msg !== 'string')) { + return; + } + // bold if (msg.indexOf(String.fromCharCode(2)) !== -1) { next = ''; @@ -1572,14 +1576,14 @@ Tabview.prototype.addMsg = function (time, nick, msg, type, style) { msg = ''; } - msg = kiwi.front.format(msg); - // Make the channels clickable re = new RegExp('\\B(' + kiwi.gateway.channel_prefix + '[^ ,.\\007]+)', 'g'); msg = msg.replace(re, function (match) { return '' + match + ''; }); + msg = kiwi.front.format(msg); + // Build up and add the line line_msg = $('
' + time + '
' + nick + '
' + msg + '
'); this.div.append(line_msg);