summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-02 01:41:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-02 01:41:04 +0000
commit1c08c20a5a1156852dbd3184360bf3ea40378916 (patch)
tree80159ddd943b6f8b60cd6c958b715b06fa10fbe4 /src
parentda40ff67132a7b7a9812080e73423b171703c304 (diff)
Fix for bug #62 (replaces only occur once per line)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1278 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_censor.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp
index c3e52899a..2d81b98f6 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -94,7 +94,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 +111,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 +130,6 @@ class ModuleCensor : public Module
{
this->ReplaceLine(text,pattern,replace);
}
-
- return 0;
}
}
return 0;
@@ -143,7 +141,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 +160,6 @@ class ModuleCensor : public Module
{
this->ReplaceLine(text,pattern,replace);
}
-
- return 0;
}
}
return 0;