From cbe5b993142c218e09ae972bdce91681cc0ba485 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 4 Apr 2020 11:49:06 +0100 Subject: Add the Numerics::CannotSendTo class and switch stuff to use it. --- src/modules/m_censor.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/modules/m_censor.cpp') diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index d216bd11f..7c7d12a6d 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -51,7 +51,6 @@ class ModuleCensor : public Module if (!IS_LOCAL(user)) return MOD_RES_PASSTHRU; - int numeric = 0; switch (target.type) { case MessageTarget::TYPE_USER: @@ -59,8 +58,6 @@ class ModuleCensor : public Module User* targuser = target.Get(); if (!targuser->IsModeSet(cu)) return MOD_RES_PASSTHRU; - - numeric = ERR_CANTSENDTOUSER; break; } @@ -73,8 +70,6 @@ class ModuleCensor : public Module ModResult result = CheckExemption::Call(exemptionprov, user, targchan, "censor"); if (result == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; - - numeric = ERR_CANNOTSENDTOCHAN; break; } @@ -89,7 +84,11 @@ class ModuleCensor : public Module { if (index->second.empty()) { - user->WriteNumeric(numeric, target.GetName(), "Your message contained a censored word (" + index->first + "), and was blocked"); + const std::string msg = InspIRCd::Format("Your message to this channel contained a banned phrase (%s) and was blocked.", index->first.c_str()); + if (target.type == MessageTarget::TYPE_CHANNEL) + user->WriteNumeric(Numerics::CannotSendTo(target.Get(), msg)); + else + user->WriteNumeric(Numerics::CannotSendTo(target.Get(), msg)); return MOD_RES_DENY; } -- cgit v1.3.1-10-gc9f91