Filter some unicode control codes out of IRC messages
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 May 2009 00:28:49 +0000 (02:28 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 May 2009 00:40:21 +0000 (02:40 +0200)
U+FDD0 and U+FDD1 are for internal Qt use and might screw up some Qt widgets if used
inappropriately. Hence, we filter them out of incoming messages.

Thanks to Sho_ and the Konversation team for the heads-up!

src/core/coresession.cpp

index 0fbfed4..13e8462 100644 (file)
@@ -201,6 +201,11 @@ void CoreSession::recvMessageFromServer(Message::Type type, BufferInfo::Type buf
   CoreNetwork *net = qobject_cast<CoreNetwork*>(this->sender());
   Q_ASSERT(net);
 
   CoreNetwork *net = qobject_cast<CoreNetwork*>(this->sender());
   Q_ASSERT(net);
 
+  // U+FDD0 and U+FDD1 are special characters for Qt's text engine, specifically they mark the boundaries of
+  // text frames in a QTextDocument. This might lead to problems in widgets displaying QTextDocuments (such as
+  // KDE's notifications), hence we remove those just to be safe.
+  text.remove(QChar(0xfdd0)).remove(QChar(0xfdd1));
+
   BufferInfo bufferInfo = Core::bufferInfo(user(), net->networkId(), bufferType, target);
   Message msg(bufferInfo, type, text, sender, flags);
   msg.setMsgId(Core::storeMessage(msg));
   BufferInfo bufferInfo = Core::bufferInfo(user(), net->networkId(), bufferType, target);
   Message msg(bufferInfo, type, text, sender, flags);
   msg.setMsgId(Core::storeMessage(msg));