From ff79475682f0181cd8bcf276f642f27c38e7f389 Mon Sep 17 00:00:00 2001 From: "gijskruitbosch%gmail.com" Date: Sat, 3 Oct 2009 20:58:56 +0000 Subject: [PATCH] Bug 491272 - Fix channel link regex, simplify other link regexes. r=silver@warwickcompsoc.co.uk (James Ross), a=NPOTFFB. git-svn-id: svn://10.0.0.236/trunk@258567 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/irc/xul/content/mungers.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mozilla/extensions/irc/xul/content/mungers.js b/mozilla/extensions/irc/xul/content/mungers.js index 2bb85c663af..cc315f602d3 100644 --- a/mozilla/extensions/irc/xul/content/mungers.js +++ b/mozilla/extensions/irc/xul/content/mungers.js @@ -23,6 +23,7 @@ * Contributor(s): * Robert Ginda, rginda@ndcico.com, original author * Samuel Sieb, samuel@sieb.net, MIRC color codes + * Gijs Kruitbosch, gijskruitbosch@gmail.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -57,7 +58,7 @@ function initMunger() * - end with whitespace, non-word, or end-of-line */ client.linkRE = - /(?:\s|\W|^)((?:(\w[\w-]+):[^\s]+|www(\.[^.\s]+){2,})\b[\/=\)]?)(?=\s|\W|$)/; + /(?:\W|^)((?:(\w[\w-]+):[^\s]+|www(\.[^.\s]+){2,})\b[\/=\)]?)(?=\s|\W|$)/; // Colours: \x03, with optional foreground and background colours client.colorRE = /(\x03((\d{1,2})(,\d{1,2}|)|))/; @@ -101,13 +102,13 @@ function initMunger() // This has a higher starting priority so as to get it to match before the // normal link, which won't know about mailto and then fail. munger.addRule(".mailto", - /(?:\s|\W|^)((mailto:)?[^:;\\<>\[\]()\'\"\s\u201d]+@[^.<>\[\]()\'\"\s\u201d]+\.[^<>\[\]()\'\"\s\u201d]+)/i, + /(?:\W|^)((mailto:)?[^:;\\<>\[\]()\'\"\s\u201d]+@[^.<>\[\]()\'\"\s\u201d]+\.[^<>\[\]()\'\"\s\u201d]+)/i, insertMailToLink, NORMAL_PRIORITY, HIGHER_PRIORITY, false); munger.addRule("bugzilla-link", - /(?:\s|\W|^)(bug\s+(?:#?\d+|#[^\s,]{1,20})(?:\s+comment\s+#?\d+)?)/i, + /(?:\W|^)(bug\s+(?:#?\d+|#[^\s,]{1,20})(?:\s+comment\s+#?\d+)?)/i, insertBugzillaLink, NORMAL_PRIORITY, NORMAL_PRIORITY); munger.addRule("channel-link", - /(?:\s|\W|^)[@%+]?(#[^<>,\[\](){}\"\s\u201d]*[^:,.<>\[\](){}\'\"\s\u201d])/i, + /(?:[^\w#]|^)[@%+]?(#[^<>,\[\](){}\"\s\u201d]*[^:,.<>\[\](){}\'\"\s\u201d])/i, insertChannelLink, NORMAL_PRIORITY, NORMAL_PRIORITY); munger.addRule("talkback-link", /(?:\W|^)(TB\d{8,}[A-Z]?)(?:\W|$)/, insertTalkbackLink, NORMAL_PRIORITY, NORMAL_PRIORITY); @@ -115,7 +116,7 @@ function initMunger() munger.addRule("face", /((^|\s)(?:[>]?[B8=:;(xX][~']?[-^v"]?(?:[)|(PpSs0oO\?\[\]\/\\]|D+)|>[-^v]?\)|[oO9][._][oO9])(\s|$))/, insertSmiley, NORMAL_PRIORITY, NORMAL_PRIORITY); - munger.addRule("rheet", /(?:\s|\W|^)(rhee+t\!*)(?:\s|$)/i, insertRheet, 10, 10); + munger.addRule("rheet", /(?:\W|^)(rhee+t\!*)(?:\s|$)/i, insertRheet, 10, 10); munger.addRule("word-hyphenator", client.whitespaceRE, insertHyphenatedWord, LOW_PRIORITY, NORMAL_PRIORITY);