diff options
-rw-r--r-- | src/modules/m_filter.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 86ef0d4f6..25941e5d8 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -165,6 +165,8 @@ class ImplFilter : public FilterResult class ModuleFilter : public Module { + void FreeFilters(); + public: CommandFilter filtcommand; dynamic_reference<RegexFactory> RegexEngine; @@ -178,6 +180,7 @@ class ModuleFilter : public Module ModuleFilter(); void init(); + CullResult cull(); ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); FilterResult* FilterMatch(User* user, const std::string &text, int flags); bool DeleteFilter(const std::string &freeform); @@ -304,6 +307,20 @@ void ModuleFilter::init() OnRehash(NULL); } +CullResult ModuleFilter::cull() +{ + FreeFilters(); + return Module::cull(); +} + +void ModuleFilter::FreeFilters() +{ + for (std::vector<ImplFilter>::const_iterator i = filters.begin(); i != filters.end(); ++i) + delete i->regex; + + filters.clear(); +} + ModResult ModuleFilter::OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { if (!IS_LOCAL(user)) |