aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_censor.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-04-09 18:06:50 +0100
committerGravatar Sadie Powell2020-04-09 18:06:50 +0100
commite1ed9b275f465fbc235a23e416ba7626c7cba6cc (patch)
treea0cda4ca3cf14e2731ada5cd6fc890eb90e80731 /src/modules/m_censor.cpp
parentMerge branch 'insp3' into master. (diff)
parentSet the minimum length to 1 for most config items with a default. (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_censor.cpp')
-rw-r--r--src/modules/m_censor.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index c7fd1ace8..708ac5f8d 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;
}