diff options
author | Sadie Powell <sadie@witchery.services> | 2021-04-06 14:43:39 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-04-06 15:15:14 +0100 |
commit | c05f81cac83e80c7727594e3929e0709eccca689 (patch) | |
tree | 72df2e8f8936d62cb95e2cda2d7ac78872752888 | |
parent | e4f7e2523b54090deb7e4f40f735893192fa51eb (diff) |
Use IsCTCP in blockcolor for ignoring CTCPs.
-rw-r--r-- | src/modules/m_blockcolor.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
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<unsigned char>(*i); + if (chr < 32) { if (modeset) user->WriteNumeric(Numerics::CannotSendTo(c, "messages containing formatting characters", &bc)); |