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:28:49 +0000 (02:28 +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 ef3b397..9f21056 100644 (file)
@@ -203,7 +203,14 @@ void CoreSession::msgFromClient(BufferInfo bufinfo, QString msg) {
 // ALL messages coming pass through these functions before going to the GUI.
 // So this is the perfect place for storing the backlog and log stuff.
 void CoreSession::recvMessageFromServer(NetworkId networkId, Message::Type type, BufferInfo::Type bufferType,
 // ALL messages coming pass through these functions before going to the GUI.
 // So this is the perfect place for storing the backlog and log stuff.
 void CoreSession::recvMessageFromServer(NetworkId networkId, Message::Type type, BufferInfo::Type bufferType,
-                                        const QString &target, const QString &text, const QString &sender, Message::Flags flags) {
+                                        const QString &target, const QString &text_, const QString &sender, Message::Flags flags) {
+
+  // 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.
+  QString text = text_;
+  text.remove(QChar(0xfdd0)).remove(QChar(0xfdd1));
+
   _messageQueue << RawMessage(networkId, type, bufferType, target, text, sender, flags);
   if(!_processMessages) {
     _processMessages = true;
   _messageQueue << RawMessage(networkId, type, bufferType, target, text, sender, flags);
   if(!_processMessages) {
     _processMessages = true;