Allow arbitrary protocols for URL detection
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 26 Mar 2009 23:07:21 +0000 (00:07 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Thu, 26 Mar 2009 23:09:12 +0000 (00:09 +0100)
Rather than hardcoding a selection of protocols, we now allow all of the
form \w+:// (plus mailto:) - this should cover all that make sense.

See also bug #641.

src/qtui/chatitem.cpp

index dd23c5c..9c84249 100644 (file)
@@ -418,7 +418,7 @@ QList<ContentsChatItem::Clickable> ContentsChatItem::findClickables() const {
   static QRegExp regExp[] = {
     // URL
     // QRegExp(QString("((?:https?://|s?ftp://|irc://|mailto:|www\\.)%1+|%1+\\.[a-z]{2,4}(?:?=/%1+|\\b))%2").arg(urlChars, urlEnd)),
-    QRegExp(QString("((?:(?:https?://|s?ftp://|irc://|gopher://|mailto:)|www)%1+)%2").arg(urlChars, urlEnd), Qt::CaseInsensitive),
+    QRegExp(QString("((?:(?:mailto:|\\w+://)|www)%1+)%2").arg(urlChars, urlEnd), Qt::CaseInsensitive),
 
     // Channel name
     // We don't match for channel names starting with + or &, because that gives us a lot of false positives.