diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_filter_pcre.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_filter.h | 11 |
3 files changed, 37 insertions, 2 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index a7829871f..0991c7def 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -149,6 +149,20 @@ class ModuleFilterPCRE : public FilterBase } } } + + virtual int OnStats(char symbol, userrec* user, string_list &results) + { + if (symbol == 's') + { + std::string sn = ServerInstance->Config->ServerName; + for (std::vector<PCREFilter>::iterator i = filters.begin(); i != filters.end(); i++) + { + results.push_back(sn+" 223 "+user->nick+" :"+i->freeform+" "+i->action+" "+ConvToStr(i->gline_time)+" :"+i->reason); + } + return 1; + } + return 0; + } }; diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index b0ace124e..30e7c2b05 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -121,6 +121,20 @@ class ModuleFilter : public FilterBase } DELETE(MyConf); } + + virtual int OnStats(char symbol, userrec* user, string_list &results) + { + if (symbol == 's') + { + std::string sn = ServerInstance->Config->ServerName; + for (filter_t::iterator n = filters.begin(); n != filters.end(); n++) + { + results.push_back(sn+" 223 "+user->nick+" :"+n->second->freeform+" "+n->second->action+" "+ConvToStr(n->second->gline_time)+" :"+n->second->reason); + } + return 1; + } + return 0; + } }; // stuff down here is the module-factory stuff. For basic modules you can ignore this. diff --git a/src/modules/m_filter.h b/src/modules/m_filter.h index 0b32ba00f..3bccf2b2b 100644 --- a/src/modules/m_filter.h +++ b/src/modules/m_filter.h @@ -61,6 +61,8 @@ class FilterBase : public Module FilterResult DecodeFilter(const std::string &data); virtual void OnSyncOtherMetaData(Module* proto, void* opaque); virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata); + + virtual int OnStats(char symbol, userrec* user, string_list &results); }; class cmd_filter : public command_t @@ -126,7 +128,7 @@ class cmd_filter : public command_t if (result.first) { user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s%s%s', reason: '%s'", user->nick, freeform.c_str(), - type.c_str(), (duration ? " duration: " : ""), (duration ? ConvToStr(duration).c_str() : ""), + type.c_str(), (duration ? " duration: " : ""), (duration ? parameters[2] : ""), reason.c_str()); return CMD_SUCCESS; } @@ -161,9 +163,14 @@ FilterBase::~FilterBase() { } +int FilterBase::OnStats(char symbol, userrec* user, string_list &results) +{ + return 0; +} + void FilterBase::Implements(char* List) { - List[I_OnSyncOtherMetaData] = List[I_OnDecodeMetaData] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnRehash] = 1; + List[I_OnStats] = List[I_OnSyncOtherMetaData] = List[I_OnDecodeMetaData] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnRehash] = 1; } int FilterBase::OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status) |