summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-10 17:04:06 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-10 17:04:06 +0000
commit6692d15462003157768a15c86192399b5b73e3c2 (patch)
tree9384ea59f85dfddb5bc372d067b0022b24883948 /src/modules/extra
parent74d2f929455e316ab69fcf620b7f9bc792f5e716 (diff)
Add gline type, and <filter:duration> value to say how long to ban for.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5666 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_filter_pcre.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index 5df48cb05..e03d27b59 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -37,8 +37,8 @@ class PCREFilter : public FilterResult
public:
pcre* regexp;
- PCREFilter(pcre* r, const std::string &rea, const std::string &act)
- : FilterResult::FilterResult(rea, act), regexp(r)
+ PCREFilter(pcre* r, const std::string &rea, const std::string &act, long gline_time)
+ : FilterResult::FilterResult(rea, act, gline_time), regexp(r)
{
}
};
@@ -86,12 +86,13 @@ class ModuleFilterPCRE : public FilterBase
for (int index = 0; index < MyConf.Enumerate("keyword"); 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 pattern = MyConf.ReadValue("keyword", "pattern", index);
+ std::string reason = MyConf.ReadValue("keyword", "reason", index);
+ std::string action = MyConf.ReadValue("keyword", "action", index);
+ long gline_time = ServerInstance->Duration(MyConf.ReadValue("keyword", "duration", index).c_str());
+
re = pcre_compile(pattern.c_str(),0,&error,&erroffset,NULL);
-
+
if (!re)
{
ServerInstance->Log(DEFAULT,"Error in regular expression: %s at offset %d: %s\n", pattern.c_str(), erroffset, error);
@@ -99,7 +100,7 @@ class ModuleFilterPCRE : public FilterBase
}
else
{
- filters.push_back(PCREFilter(re, reason, action));
+ filters.push_back(PCREFilter(re, reason, action, gline_time));
ServerInstance->Log(DEFAULT,"Regular expression %s loaded.", pattern.c_str());
}
}