Strip color codes from notifications
authorKyle Fuller <redacted>
Wed, 27 Nov 2013 08:03:16 +0000 (08:03 +0000)
committerKyle Fuller <redacted>
Wed, 27 Nov 2013 08:03:16 +0000 (08:03 +0000)
Closes #7
Closes #14

palaver.cpp

index fffd03710f0129be2a738f764fef4e6c6efc11b0..770a32a72252ed02555e20fd047a2c40ce2db090 100644 (file)
@@ -817,6 +817,12 @@ public:
 
        void ParseMessage(CNick& Nick, CString& sMessage, CChan *pChannel = NULL) {
                if (m_pNetwork->IsUserOnline() == false) {
+#if defined VERSION_MAJOR && defined VERSION_MINOR && VERSION_MAJOR >= 1 && VERSION_MINOR >= 2
+                       CString sCleanMessage = sMessage.StripControls();
+#else
+                       CString &sCleanMessage = sMessage;
+#endif
+
                        for (std::vector<CDevice*>::const_iterator it = m_vDevices.begin();
                                        it != m_vDevices.end(); ++it)
                        {
@@ -826,18 +832,18 @@ public:
                                        bool bMention = (
                                                ((pChannel == NULL) || device.HasMentionChannel(pChannel->GetName())) ||
                                                device.HasMentionNick(Nick.GetNick()) ||
-                                               device.IncludesMentionKeyword(sMessage, m_pNetwork->GetIRCNick().GetNick()));
+                                               device.IncludesMentionKeyword(sCleanMessage, m_pNetwork->GetIRCNick().GetNick()));
 
                                        if (bMention && (
                                                        (pChannel && device.HasIgnoreChannel(pChannel->GetName())) ||
                                                        device.HasIgnoreNick(Nick.GetNick()) ||
-                                                       device.IncludesIgnoreKeyword(sMessage)))
+                                                       device.IncludesIgnoreKeyword(sCleanMessage)))
                                        {
                                                bMention = false;
                                        }
 
                                        if (bMention) {
-                                               device.SendNotification(*this, Nick.GetNick(), sMessage, pChannel);
+                                               device.SendNotification(*this, Nick.GetNick(), sCleanMessage, pChannel);
                                        }
                                }
                        }
git clone https://git.99rst.org/PROJECT