Bug 97350

Summary: color in channel name has strange effects
Product: [Applications] konversation Reporter: Wouter Coekaerts <wouter>
Component: generalAssignee: Konversation Developers <konversation-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Wouter Coekaerts 2005-01-18 16:28:22 UTC
Version:           0.16 (using KDE KDE 3.3.1)
Installed from:    Debian testing/unstable Packages
OS:                Linux

A color code in a channel name that's being said has strange effects.
For example, type: #%C and you'll get
# color="#000000">
which is a link to
#<font
Comment 1 Ismail Donmez 2005-01-18 19:13:13 UTC
CVS commit by cartman: 


Escape colors in #channel. Damned mirc lamers! Regexp by JohnFlux(thanks!) edited slightly by me.
BUG:97350


  M +8 -1      common.cpp   1.16


--- kdeextragear-2/konversation/konversation/common.cpp  #1.15:1.16
@@ -50,4 +50,11 @@ QString tagURLs(const QString& text, con
   channelPattern.setCaseSensitive(false);
   
+  // See http://bugs.kde.org/show_bug.cgi?id=97350
+  QRegExp colorRegex=QRegExp("#<font color=\"#\\S+\">(.*)</font>");
+  colorRegex.setMinimal(true);
+  colorRegex.setCaseSensitive(false);
+  colorRegex.search(filteredLine);
+  filteredLine.replace(colorRegex,"#"+colorRegex.cap(1));
+
   while(channelPattern.search(filteredLine, pos) != -1) {
     


Comment 2 Ismail Donmez 2010-07-01 15:56:21 UTC
commit 33b55cd4ac0d70bf4c40c5558e2d69271ba26b5f
Author: İsmail Dönmez <ismail@kde.org>
Date:   Tue Jan 18 18:12:59 2005 +0000

    Escape colors in #channel. Damned mirc lamers! Regexp by JohnFlux(thanks!) edited slightly by me.
    BUG:97350
    
    svn path=/trunk/kdeextragear-2/konversation/; revision=379849

diff --git a/konversation/common.cpp b/konversation/common.cpp
index 3dcda73..15ac500 100644
--- a/konversation/common.cpp
+++ b/konversation/common.cpp
@@ -48,7 +48,14 @@ QString tagURLs(const QString& text, const QString& fromNick)
 			 );
   
   channelPattern.setCaseSensitive(false);
-  
+
+  // See http://bugs.kde.org/show_bug.cgi?id=97350
+  QRegExp colorRegex=QRegExp("#<font color=\"#\\S+\">(.*)</font>");
+  colorRegex.setMinimal(true);
+  colorRegex.setCaseSensitive(false);
+  colorRegex.search(filteredLine);
+  filteredLine.replace(colorRegex,"#"+colorRegex.cap(1));
+
   while(channelPattern.search(filteredLine, pos) != -1) {
     
     // Remember where we found the url