diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-03-22 18:43:42 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-03-22 18:43:42 +0000 |
commit | fa2d0dd4f0e96cf0e937cc3e79b68519e15f2fb0 (patch) | |
tree | 22b8cdf5cd6cce48dd65d43c6c45b2063be3f5ba /src/modules | |
parent | d84050a6c8334774feb71ed0b3a8a60977b376a5 (diff) |
Apply ankit's patch for bug #780 with a minor tweak, re-introduce the 4-param 404 numeric, this should not affect any clients but should make scripts and bots lives easier. Thanks ankit.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11244 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_chanfilter.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_muteban.cpp | 4 |
3 files changed, 17 insertions, 5 deletions
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 ¶meter) { + 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; } } |