- for (int index = 0; index < MyConf.Enumerate("keyword"); index++)
- {
- this->DeleteFilter(MyConf.ReadValue("keyword", "pattern", index));
-
- std::string pattern = MyConf.ReadValue("keyword", "pattern", index);
- std::string reason = MyConf.ReadValue("keyword", "reason", index);
- std::string action = MyConf.ReadValue("keyword", "action", index);
- std::string flgs = MyConf.ReadValue("keyword", "flags", index);
- long gline_time = ServerInstance->Duration(MyConf.ReadValue("keyword", "duration", index));
- if (action.empty())
- action = "none";
- if (flgs.empty())
- flgs = "*";
-
- try
- {
- filters.push_back(ImplFilter(this, reason, action, gline_time, pattern, flgs));
- ServerInstance->Logs->Log("m_filter", DEFAULT, "Regular expression %s loaded.", pattern.c_str());
- }
- catch (ModuleException &e)
- {
- ServerInstance->Logs->Log("m_filter", DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason());
- }
- }
- }
-
- virtual int OnStats(char symbol, User* user, string_list &results)
- {
- if (symbol == 's')
- {
- std::string sn = ServerInstance->Config->ServerName;
- for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
- {
- results.push_back(sn+" 223 "+user->nick+" :"+RegexEngine+":"+i->freeform+" "+i->flags+" "+i->action+" "+ConvToStr(i->gline_time)+" :"+i->reason);
- }
- for (std::vector<std::string>::iterator i = exemptfromfilter.begin(); i != exemptfromfilter.end(); ++i)
- {
- results.push_back(sn+" 223 "+user->nick+" :EXEMPT "+(*i));
- }
- }
- return 0;