From c05f81cac83e80c7727594e3929e0709eccca689 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Apr 2021 14:43:39 +0100 Subject: Use IsCTCP in blockcolor for ignoring CTCPs. --- src/modules/m_blockcolor.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index c5dc35fe3..905cc50b5 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -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(*i); + if (chr < 32) { if (modeset) user->WriteNumeric(Numerics::CannotSendTo(c, "messages containing formatting characters", &bc)); -- cgit v1.2.3