Bug 247882 - Realnames in nicklist: No awareness of formatting chars
Summary: Realnames in nicklist: No awareness of formatting chars
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: 1.3.1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-14 19:50 UTC by Jonas Thiem
Modified: 2010-08-15 13:55 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 Jonas Thiem 2010-08-14 19:50:13 UTC
Version:           1.3.1 (using KDE 4.4.5) 
OS:                Linux

I observed some kvirc user with formatting chars in its realname which revealed some minor issue with Konversation's "realnames shown in the nicklist" feature:

http://eloxoph.com/archive/realnameabnormalities.png

What you can see in the nicklist there (those strange characters at the beginning of the realname) is actually ascii-3 (colour code), '1' (sets text colour 1), ascii-15 (resets everything again) which KVIrc puts there for some very odd reason.

The point is, while the chat window just either removes the formatting or parses it correctly (can't be seen since that formatting actually does nothing), the nicklist doesn't even filter those formatting byte sequences out but keeps them in there and attempts to show them interpreted as real text (which of course results in strange characters being shown).

Reproducible: Always

Steps to Reproduce:
1. Find a way to put the 3 formatting bytes at the beginning of your realname: 3, 49, 15 (decimal values)
2. Activate realnames getting shown in the nicklist
3. Join a channnel and examine your entry in the nicklist

Actual Results:  
Your realname in the nicklist will be shown with strange chars at the beginning due to the formatting chars not being properly recognised

Expected Results:  
The formatting gets stripped (that's what I'd recommend) or even properly parsed into colours etc (which would probably look odd in the nicklist if someone chose to run around with a rainbow coloured realname or something)
Comment 1 Peter Simonsson 2010-08-15 13:55:54 UTC
commit a64122d8b578e0adc9680bc1ad3a8b0d7fb20631
Author: Peter Simonsson <peter.simonsson@gmail.com>
Date:   Sun Aug 15 13:57:10 2010 +0200

    Remove irc markup from real name in nicklist.
    
    Also clean up the code a bit.
    BUG:247882

diff --git a/src/irc/nick.cpp b/src/irc/nick.cpp
index cef0043..298eafb 100644
--- a/src/irc/nick.cpp
+++ b/src/irc/nick.cpp
@@ -150,16 +150,18 @@ QString Nick::calculateLabel1() const
     NickInfoPtr nickinfo = getChannelNick()->getNickInfo();
     KABC::Addressee addressee = nickinfo->getAddressee();
 
+    QString retString = nickinfo->getNickname();
+
     if(!addressee.realName().isEmpty())           //if no addressee, realName will be empty
     {
-        return nickinfo->getNickname() + " (" + addressee.realName() + ')';
+        retString += " (" + Konversation::removeIrcMarkup(addressee.realName()) + ')';
     }
     else if(Preferences::self()->showRealNames() && !nickinfo->getRealName().isEmpty())
     {
-        return nickinfo->getNickname() + " (" + nickinfo->getRealName() + ')';
+        retString += " (" + Konversation::removeIrcMarkup(nickinfo->getRealName()) + ')';
     }
 
-    return nickinfo->getNickname();
+    return retString;
 }
 
 QString Nick::calculateLabel2() const