[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/kopete/libkopete
From: Olivier Goffart <ogoffart () tiscalinet ! be>
Date: 2003-08-01 21:34:53
[Download RAW message or body]
CVS commit by ogoffart:
Some fix in the url parsing
-fix when the url ends with two spaces (the was interpreted)
-fix adress like http://www.xyz.com/~www.xxx.y where the second www was interpreted \
too
-add tool-tip
PLEASE TEST URL
M +6 -5 kopetemessage.cpp 1.119
--- kdenonbeta/kopete/libkopete/kopetemessage.cpp #1.118:1.119
@@ -480,11 +480,10 @@ QString KopeteMessage::parseLinks( const
//Replace http/https/ftp links
- result.replace( QRegExp( \
QString::fromLatin1("\\b((http(s?)://\\w|ftp://\\w)[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") \
), QString::fromLatin1("<a href=\"\\1\">\\1</a>" ) );
- result.replace( QRegExp( \
QString::fromLatin1("^(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") ), \
QString::fromLatin1("<a href=\"http://\\1\">\\1</a>" ) );
- result.replace( QRegExp( \
QString::fromLatin1("([^/])\\b(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") ), \
QString::fromLatin1("\\1<a href=\"http://\\2\">\\2</a>" ) );
-
+ result.replace( QRegExp( \
QString::fromLatin1("(?:\\b| )((?:http(?:s?)://\\w|ftp://\\w)[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)(?:\\b| )") \
), QString::fromLatin1("<a href=\"\\1\" title=\"\\1\">\\1</a>" ) ); + \
result.replace( QRegExp( \
QString::fromLatin1("^(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)(?:\\b| )") ), \
QString::fromLatin1("<a href=\"http://\\1\" title=\"http://\\1\">\\1</a>" ) ); + \
result.replace( QRegExp( \
QString::fromLatin1("([^/.;,?#=\\-%~])\\b(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)(?:\\b| )") \
), QString::fromLatin1("\\1<a href=\"http://\\2\" title=\"http://\\2\">\\2</a>" ) ); \
//Replace Email Links
- result.replace( QRegExp( \
QString::fromLatin1("\\b([\\w-_\\.]+@([-_\\w\\.]+\\.\\w+)+)\\b") ), \
QString::fromLatin1("<a href=\"mailto:\\1\">\\1</a>") ); + result.replace( \
QRegExp( QString::fromLatin1("(?:\\b| )([\\w\\-_\\.]+@(?:[-_\\w\\.]+\\.\\w+)+)(?:\\b| )") \
), QString::fromLatin1("<a href=\"mailto:\\1\" title=\"mailto:\\1\">\\1</a>") );
return result;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic