]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Use IsCTCP in blockcolor for ignoring CTCPs.
authorSadie Powell <sadie@witchery.services>
Tue, 6 Apr 2021 13:43:39 +0000 (14:43 +0100)
committerSadie Powell <sadie@witchery.services>
Tue, 6 Apr 2021 14:15:14 +0000 (15:15 +0100)
src/modules/m_blockcolor.cpp

index c5dc35fe371b52fc1881a6686716b3fdc2c52772..905cc50b5f611d17273b9dec3ceff4dfca8f0c40 100644 (file)
@@ -60,10 +60,15 @@ class ModuleBlockColor : public Module
                        bool modeset = c->IsModeSet(bc);
                        if (!c->GetExtBanStatus(user, 'c').check(!modeset))
                        {
-                               for (std::string::iterator i = details.text.begin(); i != details.text.end(); i++)
+                               std::string ctcpname; // Unused.
+                               std::string message;
+                               if (!details.IsCTCP(ctcpname, message))
+                                       message.assign(details.text);
+
+                               for (std::string::iterator i = message.begin(); i != message.end(); ++i)
                                {
-                                       // Block all control codes except \001 for CTCP
-                                       if ((*i >= 0) && (*i < 32) && (*i != 1))
+                                       const unsigned char chr = static_cast<unsigned char>(*i);
+                                       if (chr < 32)
                                        {
                                                if (modeset)
                                                        user->WriteNumeric(Numerics::CannotSendTo(c, "messages containing formatting characters", &bc));