summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/modules.conf.example4
-rw-r--r--src/modules/m_chanfilter.cpp8
-rw-r--r--src/modules/m_filter.cpp10
-rw-r--r--src/modules/m_muteban.cpp4
4 files changed, 21 insertions, 5 deletions
diff --git a/conf/modules.conf.example b/conf/modules.conf.example
index 209e405db..b8306dbb5 100644
--- a/conf/modules.conf.example
+++ b/conf/modules.conf.example
@@ -374,6 +374,10 @@
# Channel filter module: Allows channel-op defined message
# filtering using simple string matches (channel mode +g)
#<module name="m_chanfilter.so">
+#
+# If hidemask is set to yes, the user will not be shown the mask when
+# his/her message is blocked.
+#<chanfilter hidemask="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Channel logging module: used to send snotice output to channels, to
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 1a3764eee..3bc24c5c9 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -59,6 +59,7 @@ class ModuleChanFilter : public Module
{
ChanFilter* cf;
+ bool hidemask;
public:
@@ -83,6 +84,8 @@ class ModuleChanFilter : public Module
virtual void OnRehash(User* user, const std::string &parameter)
{
+ ConfigReader Conf(ServerInstance);
+ hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0);
cf->DoRehash();
}
@@ -100,7 +103,10 @@ class ModuleChanFilter : public Module
{
if (InspIRCd::Match(text, i->mask))
{
- user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked",user->nick.c_str(), chan->name.c_str(), i->mask.c_str());
+ if (hidemask)
+ user->WriteNumeric(404, "%s %s :Cannot send to channel (your message contained a censored word)",user->nick.c_str(), chan->name.c_str());
+ else
+ user->WriteNumeric(404, "%s %s %s :Cannot send to channel (your message contained a censored word: %s)",user->nick.c_str(), chan->name.c_str(), i->mask.c_str(), i->mask.c_str());
return 1;
}
}
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index cff996c64..3bbdf0eb4 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -283,11 +283,17 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri
if (f->action == "block")
{
ServerInstance->SNO->WriteToSnoMask('A', std::string("FILTER: ")+user->nick+" had their message filtered, target was "+target+": "+f->reason);
- user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message has been filtered and opers notified: "+f->reason);
+ if (target_type == TYPE_CHANNEL)
+ user->WriteNumeric(404, "%s %s :Message to channel blocked and opers notified (%s)",user->nick.c_str(), target.c_str(), f->reason.c_str());
+ else
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message to "+target+" was blocked and opers notified: "+f->reason);
}
if (f->action == "silent")
{
- user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message has been filtered: "+f->reason);
+ if (target_type == TYPE_CHANNEL)
+ user->WriteNumeric(404, "%s %s :Message to channel blocked (%s)",user->nick.c_str(), target.c_str(), f->reason.c_str());
+ else
+ user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message to "+target+" was blocked: "+f->reason);
}
if (f->action == "kill")
{
diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp
index 811c85e0d..8a3d40896 100644
--- a/src/modules/m_muteban.cpp
+++ b/src/modules/m_muteban.cpp
@@ -43,7 +43,7 @@ class ModuleQuietBan : public Module
{
if (((Channel *)dest)->GetExtBanStatus(user, 'm') < 0)
{
- user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot send to " + ((Channel *)dest)->name + ", as you are muted");
+ user->WriteNumeric(404, "%s %s :Cannot send to channel (you're muted)",user->nick.c_str(), ((Channel *)dest)->name.c_str());
return 1;
}
}
@@ -60,7 +60,7 @@ class ModuleQuietBan : public Module
{
if (((Channel *)dest)->GetExtBanStatus(user, 'm') < 0)
{
- user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Cannot send to " + ((Channel *)dest)->name + ", as you are muted");
+ user->WriteNumeric(404, "%s %s :Cannot send to channel (you're muted)",user->nick.c_str(), ((Channel *)dest)->name.c_str());
return 1;
}
}