]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_censor.cpp
Updated to keep lowermap const within hashcomp.cpp
[user/henk/code/inspircd.git] / src / modules / m_censor.cpp
index c3e52899aa359b132f38ba55d8671979b9de9c6d..64a01b8fc119408c5b4a61734e14eeead9977066 100644 (file)
@@ -19,6 +19,7 @@
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
+#include "helperfuncs.h"
 
 /* $ModDesc: Provides user and channel +G mode */
 
@@ -94,7 +95,7 @@ class ModuleCensor : public Module
        {
                if ((pattern != "") && (text != ""))
                {
-                       while (strstr(text.c_str(),pattern.c_str()))
+                       while (text.find(pattern) != std::string::npos)
                        {
                                int pos = text.find(pattern);
                                text.erase(pos,pattern.length());
@@ -111,7 +112,7 @@ class ModuleCensor : public Module
                for (int index = 0; index < MyConf->Enumerate("badword"); index++)
                {
                        std::string pattern = MyConf->ReadValue("badword","text",index);
-                       if (strstr(text.c_str(),pattern.c_str()))
+                       if (text.find(pattern) != std::string::npos)
                        {
                                std::string replace = MyConf->ReadValue("badword","replace",index);
 
@@ -130,8 +131,6 @@ class ModuleCensor : public Module
                                {
                                        this->ReplaceLine(text,pattern,replace);
                                }
-                               
-                               return 0;
                        }
                }
                return 0;
@@ -143,7 +142,7 @@ class ModuleCensor : public Module
                for (int index = 0; index < MyConf->Enumerate("badword"); index++)
                {
                        std::string pattern = MyConf->ReadValue("badword","text",index);
-                       if (strstr(text.c_str(),pattern.c_str()))
+                       if (text.find(pattern) != std::string::npos)
                        {
                                std::string replace = MyConf->ReadValue("badword","replace",index);
 
@@ -162,8 +161,6 @@ class ModuleCensor : public Module
                                {
                                        this->ReplaceLine(text,pattern,replace);
                                }
-                               
-                               return 0;
                        }
                }
                return 0;