From 1f3e479f36d72cd658d52524cf29b674a020f53f Mon Sep 17 00:00:00 2001
From: Kai Denker <kai.denker@gmx.net>
Date: Wed, 17 Mar 2010 23:39:44 +0100
Subject: [PATCH] Modified CoreBasicHandler::displayMsg() to remove a prefix from the
 target name only if the result is still a valid channel name.

---
 src/core/corebasichandler.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/core/corebasichandler.cpp b/src/core/corebasichandler.cpp
index d15a594..3e6865e 100644
--- a/src/core/corebasichandler.cpp
+++ b/src/core/corebasichandler.cpp
@@ -118,7 +118,9 @@ void CoreBasicHandler::putCmd(const QString &cmd, const QByteArray &param, const
 }
 
 void CoreBasicHandler::displayMsg(Message::Type msgType, QString target, const QString &text, const QString &sender, Message::Flags flags) {
-  if(!target.isEmpty() && network()->prefixes().contains(target[0]))
+  // Since some server use the same characters for PREFIX and for CHANTYPES,
+  // remove prefix only if the result is still a channel name.
+  if(!target.isEmpty() && network()->prefixes().contains(target[0]) && network()->isChannelName(target.mid(1)))
     target = target.mid(1);
 
   IrcChannel *channel = network()->ircChannel(target);
-- 
1.6.3.3

