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("\\1" ) );
- result.replace( QRegExp( QString::fromLatin1("^(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") ), QString::fromLatin1("\\1" ) );
- result.replace( QRegExp( QString::fromLatin1("([^/])\\b(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)\\b") ), QString::fromLatin1("\\1\\2" ) );
-
+ result.replace( QRegExp( QString::fromLatin1("(?:\\b| )((?:http(?:s?)://\\w|ftp://\\w)[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)(?:\\b| )") ), QString::fromLatin1("\\1" ) );
+ result.replace( QRegExp( QString::fromLatin1("^(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)(?:\\b| )") ), QString::fromLatin1("\\1" ) );
+ result.replace( QRegExp( QString::fromLatin1("([^/.;,?#=\\-%~])\\b(www\\.[-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)(?:\\b| )") ), QString::fromLatin1("\\1\\2" ) );
//Replace Email Links
- result.replace( QRegExp( QString::fromLatin1("\\b([\\w-_\\.]+@([-_\\w\\.]+\\.\\w+)+)\\b") ), QString::fromLatin1("\\1") );
+ result.replace( QRegExp( QString::fromLatin1("(?:\\b| )([\\w\\-_\\.]+@(?:[-_\\w\\.]+\\.\\w+)+)(?:\\b| )") ), QString::fromLatin1("\\1") );
return result;