]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Strip all control codes except \001 in InspIRCd::StripColor()
authorAttila Molnar <attilamolnar@hush.com>
Tue, 8 Dec 2015 15:32:50 +0000 (16:32 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Tue, 8 Dec 2015 15:32:50 +0000 (16:32 +0100)
Fixes issue #1100 reported by @uecasm

docs/conf/modules.conf.example
include/inspircd.h
src/helperfuncs.cpp

index dddd6b91f926ba408dcbe72b44e6d95836004c23..aef45106ccec869621d10a8fd8ef1100dbcfbb8b 100644 (file)
 # http://wiki.inspircd.org/Modules/ssl_openssl                        #
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
-# Strip color module: Adds channel mode +S that strips mIRC color
-# codes from all messages sent to the channel.
+# Strip color module: Adds channel mode +S that strips color codes and
+# all control codes except CTCP from all messages sent to the channel.
 #<module name="stripcolor">
 
 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
index d41d2919b5e70ccb8245ebfc303ee95a01c5ea05..91b70fbd8bbffe7bf80fbda14d2d907af1418fd4 100644 (file)
@@ -546,7 +546,7 @@ class CoreExport InspIRCd
         */
        static bool IsValidMask(const std::string& mask);
 
-       /** Strips all color codes from the given string
+       /** Strips all color and control codes except 001 from the given string
         * @param sentence The string to strip from
         */
        static void StripColor(std::string &sentence);
index 78d272b5f73d5675648651438d88405cdddbb43c..6217eb20ba2139ca4e2dfe725a996aa55c2ee0b4 100644 (file)
@@ -127,7 +127,8 @@ void InspIRCd::StripColor(std::string &sentence)
                else
                        seq = 0;
 
-               if (seq || ((*i == 2) || (*i == 15) || (*i == 22) || (*i == 21) || (*i == 31)))
+               // Strip all control codes too except \001 for CTCP
+               if (seq || ((*i < 32) && (*i != 1)))
                        i = sentence.erase(i);
                else
                        ++i;