X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_anticaps.cpp;h=6cb9b940b3c0b119aae73c531008c8675ff455db;hb=de4e4860091fe5a9a530acdb25f9a17e22323acf;hp=755ab8bfa753a30e8cee17e7fba104b4ee1ef1a9;hpb=71c367f89f5384eb05cf191f63ed5094e90b46ad;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp index 755ab8bfa..6cb9b940b 100644 --- a/src/modules/m_anticaps.cpp +++ b/src/modules/m_anticaps.cpp @@ -216,23 +216,18 @@ class ModuleAntiCaps : public Module // If the user is exempt from anticaps then we don't need // to do anything else. ModResult result = CheckExemption::Call(exemptionprov, user, channel, "anticaps"); - if (result == MOD_RES_ALLOW) + if (result == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; // If the message is a CTCP then we skip it unless it is - // an ACTION in which case we skip the prefix and suffix. - std::string::const_iterator text_begin = details.text.begin(); - std::string::const_iterator text_end = details.text.end(); - if (details.text[0] == '\1') + // an ACTION in which case we just check against the body. + std::string ctcpname; + std::string msgbody(details.text); + if (details.IsCTCP(ctcpname, msgbody)) { // If the CTCP is not an action then skip it. - if (details.text.compare(0, 8, "\1ACTION ", 8)) + if (!irc::equals(ctcpname, "ACTION")) return MOD_RES_PASSTHRU; - - // Skip the CTCP message characters. - text_begin += 8; - if (*details.text.rbegin() == '\1') - text_end -= 1; } // Retrieve the anticaps config. This should never be @@ -243,14 +238,14 @@ class ModuleAntiCaps : public Module // If the message is shorter than the minimum length then // we don't need to do anything else. - size_t length = std::distance(text_begin, text_end); + size_t length = msgbody.length(); if (length < config->minlen) return MOD_RES_PASSTHRU; // Count the characters to see how many upper case and // ignored (non upper or lower) characters there are. size_t upper = 0; - for (std::string::const_iterator iter = text_begin; iter != text_end; ++iter) + for (std::string::const_iterator iter = msgbody.begin(); iter != msgbody.end(); ++iter) { unsigned char chr = static_cast(*iter); if (uppercase.test(chr))