X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_filter.cpp;h=60ae7e89158a081e59ae6bc22bf2c2c214ee414b;hb=00fa6d592ed2640fcdf74444786de555c1c3da25;hp=1c92317386b95efb539f51540e8b412b0da9c17f;hpb=8662f747e716f5c2a0e724f2a1ba54b060ae1f97;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 1c9231738..60ae7e891 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team + * InspIRCd: (C) 2002-2009 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -12,9 +12,6 @@ */ #include "inspircd.h" -#include "users.h" -#include "channels.h" -#include "modules.h" #include "xline.h" #include "m_regex.h" @@ -133,10 +130,10 @@ class CommandFilter : public Command { FilterBase* Base; public: - CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1), Base(f) + CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1, 5), Base(f) { this->source = ssource; - this->syntax = " [] :"; + this->syntax = " [] :"; } CmdResult Handle(const std::vector ¶meters, User *user) @@ -146,12 +143,13 @@ class CommandFilter : public Command /* Deleting a filter */ if (Base->DeleteFilter(parameters[0])) { - user->WriteServ("NOTICE %s :*** Deleted filter '%s'", user->nick.c_str(), parameters[0].c_str()); + user->WriteServ("NOTICE %s :*** Removed filter '%s'", user->nick.c_str(), parameters[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('A', std::string("FILTER: ")+user->nick+" removed filter '"+parameters[0]+"'"); return CMD_SUCCESS; } else { - user->WriteServ("NOTICE %s :*** Filter '%s' not found on list.", user->nick.c_str(), parameters[0].c_str()); + user->WriteServ("NOTICE %s :*** Filter '%s' not found in list, try /stats s.", user->nick.c_str(), parameters[0].c_str()); return CMD_FAILURE; } } @@ -182,7 +180,7 @@ class CommandFilter : public Command } else { - this->TooFewParams(user, " When setting a gline type filter, a gline duration must be specified as the third parameter."); + this->TooFewParams(user, ": When setting a gline type filter, a gline duration must be specified as the third parameter."); return CMD_FAILURE; } } @@ -194,8 +192,11 @@ class CommandFilter : public Command if (result.first) { user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(), - type.c_str(), (duration ? " duration: " : ""), (duration ? parameters[3].c_str() : ""), + type.c_str(), (duration ? ", duration " : ""), (duration ? parameters[3].c_str() : ""), flags.c_str(), reason.c_str()); + + ServerInstance->SNO->WriteToSnoMask('A', std::string("FILTER: ")+user->nick+" added filter '"+freeform+"', type '"+type+"', "+(duration ? "duration "+parameters[3]+", " : "")+"flags '"+flags+"', reason: "+reason); + return CMD_SUCCESS; } else @@ -280,7 +281,7 @@ int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::stri if (i != exemptfromfilter.end()) return 0; } 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); } @@ -317,7 +318,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector &par std::string checkline; int replacepoint = 0; bool parting = false; - + if (command == "QUIT") { /* QUIT with no reason: nothing to do */ @@ -347,7 +348,7 @@ int FilterBase::OnPreCommand(std::string &command, std::vector &par return 0; FilterResult* f = NULL; - + if (flags) f = this->FilterMatch(user, checkline, flags); @@ -682,4 +683,3 @@ class ModuleFilter : public FilterBase }; MODULE_INIT(ModuleFilter) -