diff options
| author | 2020-04-04 11:49:06 +0100 | |
|---|---|---|
| committer | 2020-04-04 12:31:14 +0100 | |
| commit | cbe5b993142c218e09ae972bdce91681cc0ba485 (patch) | |
| tree | 61e925088e25c4ba7e1e011929fb13555400c42a /src/modules/m_censor.cpp | |
| parent | Ignore clients on ulined servers when counting invisible users. (diff) | |
Add the Numerics::CannotSendTo class and switch stuff to use it.
Diffstat (limited to 'src/modules/m_censor.cpp')
| -rw-r--r-- | src/modules/m_censor.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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<User>(); 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<Channel>(), msg)); + else + user->WriteNumeric(Numerics::CannotSendTo(target.Get<User>(), msg)); return MOD_RES_DENY; } |
