summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_filter_pcre.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp
index 19ff1b48c..e35094ac0 100644
--- a/src/modules/extra/m_filter_pcre.cpp
+++ b/src/modules/extra/m_filter_pcre.cpp
@@ -6,7 +6,7 @@
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
- * the file COPYING for details.
+ * the file COPYING for details.
*
* ---------------------------------------------------
*/
@@ -56,13 +56,18 @@ class ModuleFilterPCRE : public FilterBase
virtual FilterResult* FilterMatch(const std::string &text)
{
- for (unsigned int index = 0; index < filters.size(); index++)
+ for (std::vector<PCREFilter>::iterator index = filters.begin(); index != filters.end(); index++)
{
- PCREFilter& filt = filters[index];
-
- if (pcre_exec(filt.regexp,NULL,text.c_str(),text.length(),0,0,NULL,0) > -1)
+ if (pcre_exec(index->regexp, NULL, text.c_str(), text.length(), 0, 0, NULL, 0) > -1)
{
- return &filt;
+ PCREFilter* fr = &(*index);
+ if (index != filters.begin())
+ {
+ filters.erase(index);
+ filters.insert(filters.begin(), *fr);
+ index = filters.begin();
+ }
+ return &(*index);
}
}
return NULL;