diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-05 22:31:28 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-04-05 22:31:28 +0000 |
commit | 6c22aee160c2f0b0d761711f12eca8f875c81062 (patch) | |
tree | 85d6fc4fee9619a341509915e8f75e9c59a6a56e /src/modules | |
parent | 37c77c74a0c18d7c2ea57650d1f518697db75a8a (diff) |
Add filter type 'silent', as requested in bug #235 reported by Casey.
filter type silent for m_filter and m_filter_pcre does not notify opers, and just blocks the text. It does however tell the user their text was blocked and still log.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6739 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_filter.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h index 896c75dc2..b31a03271 100644 --- a/src/modules/m_filter.h +++ b/src/modules/m_filter.h @@ -96,9 +96,9 @@ class cmd_filter : public command_t std::string reason; long duration = 0; - if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill")) + if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill") && (type != "silent")) { - user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', and 'kill'.", user->nick, freeform.c_str()); + user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', 'silent' and 'kill'.", user->nick, freeform.c_str()); return CMD_FAILURE; } @@ -190,10 +190,13 @@ int FilterBase::OnUserPreNotice(userrec* user,void* dest,int target_type, std::s } if (f->action == "block") { - ServerInstance->WriteOpers(std::string("FILTER: ")+user->nick+" had their notice filtered, target was "+target+": "+f->reason); - user->WriteServ("NOTICE "+std::string(user->nick)+" :Your notice has been filtered and opers notified: "+f->reason); + ServerInstance->WriteOpers(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 (f->action == "silent") + { + user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message has been filtered: "+f->reason); } - ServerInstance->Log(DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their notice filtered, target was ")+target+": "+f->reason+" Action: "+f->action); if (f->action == "kill") { userrec::QuitUser(ServerInstance,user,"Filtered: "+f->reason); @@ -206,6 +209,8 @@ int FilterBase::OnUserPreNotice(userrec* user,void* dest,int target_type, std::s FOREACH_MOD(I_OnAddGLine,OnAddGLine(f->gline_time, NULL, f->reason, user->MakeHostIP())); } } + + ServerInstance->Log(DEFAULT,"FILTER: "+std::string(user->nick)+std::string(" had their message filtered, target was ")+target+": "+f->reason+" Action: "+f->action); return 1; } return 0; @@ -249,14 +254,10 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters /* PART or QUIT reason doesnt match a filter */ return 0; - ServerInstance->Log(DEBUG,"Match block text"); - /* We cant block a part or quit, so instead we change the reason to 'Reason filtered' */ command_t* c = ServerInstance->Parser->GetHandler(command); if (c) { - ServerInstance->Log(DEBUG,"Found handler"); - const char* params[127]; for (int item = 0; item < pcnt; item++) params[item] = parameters[item]; @@ -265,7 +266,7 @@ int FilterBase::OnPreCommand(const std::string &command, const char** parameters /* We're blocking, OR theyre quitting and its a KILL action * (we cant kill someone whos already quitting, so filter them anyway) */ - if ((f->action == "block") || (((!parting) && (f->action == "kill")))) + if ((f->action == "block") || (((!parting) && (f->action == "kill"))) || (f->action == "silent")) { c->Handle(params, pcnt, user); return 1; |