Bug 62690 - Links generated using only parts of URL
Summary: Links generated using only parts of URL
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: general (show other bugs)
Version: 0.7.1
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-14 23:52 UTC by Christian Nitschkowski
Modified: 2004-01-06 04:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Nitschkowski 2003-08-14 23:52:02 UTC
Version:           0.7.1 (using KDE KDE 3.1.3)
Installed from:    SuSE RPMs
Compiler:          Gcc 3.3 20030226 (prerelease) (SuSE Linux)
OS:          Linux

When I send an URL like
fish://user@host/path
only user@host will be a clickable link.
It looks like kopete creates something like this of it:
fish://<a href="mailto:user@host">user@host</a>/path
although it should generate
<a href="fish://user@host/path">fish://user@host/path</a>

(Hope the tags won't be cut off by Bugzilla)
Comment 1 Matt Rogers 2003-08-30 17:18:37 UTC
this seems more like a wishlist bug to me, but I'll work on it. :) 
Comment 2 Jason Keirstead 2004-01-06 04:37:06 UTC
Subject: kdenetwork/kopete/libkopete

CVS commit by brunes: 

Fix regexp to handle any link type and not barf on @ symbols

CCMAIL: 62690-done@bugs.kde.org


  M +2 -2      kopetemessage.cpp   1.130


--- kdenetwork/kopete/libkopete/kopetemessage.cpp  #1.129:1.130
@@ -485,10 +485,10 @@ QString KopeteMessage::parseLinks( const
 
         //Replace http/https/ftp links
-        result.replace( QRegExp( QString::fromLatin1("(?:\\b|&nbsp;)((?:http(?:s?)://\\w|ftp://\\w)[-\\w\\._]+[\\+-\\w\\./#&;:=\\?~%_,]*)(?:\\b|&nbsp;)") ), QString::fromLatin1("<a href=\"\\1\" title=\"\\1\">\\1</a>" ) );
+        result.replace( QRegExp( QString::fromLatin1("(?:\\b|&nbsp;)(\\w+://(\\w+\\@){0,1}[\\+-\\w\./#@&;:=\\?~%_,]*)(?:\\b|&nbsp;)") ), QString::fromLatin1("<a href=\"\\1\" title=\"\\1\">\\1</a>" ) );
         result.replace( QRegExp( QString::fromLatin1("^(www\\.[-\\w\\._]+[\\+-\\w\\./#&;:=\\?~%_,]*)(?:\\b|&nbsp;)") ), QString::fromLatin1("<a href=\"http://\\1\" title=\"http://\\1\">\\1</a>" ) );
         result.replace( QRegExp( QString::fromLatin1("([^/.;,?#=\\-%~])\\b(www\\.[\\+-\\w\\._]+[-\\w\\./#&;:=\\?~%_,]*)(?:\\b|&nbsp;)") ), QString::fromLatin1("\\1<a href=\"http://\\2\" title=\"http://\\2\">\\2</a>" ) );
 
         //Replace Email Links
-        result.replace( QRegExp( QString::fromLatin1("(?:\\b|&nbsp;)([\\w\\-_\\.]+@(?:[\\+-_\\w\\.]+\\.\\w+)+)(?:\\b|&nbsp;)") ), QString::fromLatin1("<a href=\"mailto:\\1\" title=\"mailto:\\1\">\\1</a>") );
+        result.replace( QRegExp( QString::fromLatin1("(?:\\b|&nbsp;)([\\w\\-_\\.]+@(?:[\\+-_\\w\\.]+\\.\\w+)+)(?:\\b|&nbsp;)(?!.*</a>)") ), QString::fromLatin1("<a href=\"mailto:\\1\" title=\"mailto:\\1\">\\1</a>") );
 
         return result;