Update stripFormatCodes() for additional formatting characters
authorMichael Marley <michael@michaelmarley.com>
Thu, 1 Mar 2018 22:19:47 +0000 (17:19 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 7 Mar 2018 09:32:29 +0000 (10:32 +0100)
 - \x04 for hex color (IRCCloud)
 - \x11 for monospace (IRCCloud)
 - \x1e for strikethrough (Textual)

This patch does not actually add support for rendering those
styles, but at least ensures that highlighting still works
correctly if they are used.

Closes GH-337.

src/common/util.cpp

index a59db8f..d9b9d2a 100644 (file)
@@ -73,7 +73,7 @@ bool isChannelName(const QString &str)
 
 QString stripFormatCodes(QString message)
 {
-    static QRegExp regEx{"\x03(\\d\\d?(,\\d\\d?)?)?|[\x02\x0f\x12\x16\x1d\x1f]"};
+    static QRegExp regEx{"\x03(\\d\\d?(,\\d\\d?)?)?|\x04([\\da-fA-F]{6}(,[\\da-fA-F]{6})?)?|[\x02\x0f\x11\x12\x16\x1d\x1e\x1f]"};
     return message.remove(regEx);
 }