summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcertus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-05-15 10:24:52 +0000
committercertus certus@31f1291d-b8d6-0310-a050-a5561fc1590b <certus certus@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-05-15 10:24:52 +0000
commit8431d0515f24c01e413085191db0511e0c853d43 (patch)
tree7c7b0266471afc1d44525ae3751cba0f728f8ddb
parentece1f278968c05e910cb415cff81729e83b3944a (diff)
BUILD : 1.7.2 (106) BUGS : NOTES : Added BSCaseSensitive directive for a cAsE sEnSiTiVe badword kicker.
git-svn-id: svn://svn.anope.org/anope/trunk@106 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@82 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes1
-rw-r--r--Changes.conf5
-rw-r--r--botserv.c56
-rw-r--r--config.c2
-rw-r--r--data/example.conf5
-rw-r--r--extern.h1
-rw-r--r--version.log6
7 files changed, 63 insertions, 13 deletions
diff --git a/Changes b/Changes
index b5e3dace6..93bb0df76 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
Anope Version 1.7.x (will be renamed when next release is produced)
-------------------
Provided by Anope Dev. <dev@anope.org>
+2004/05/15 Added BSCaseSensitive directive for a cAsE sEnSiTiVe badword kicker.
2004/05/14 Removed some illegal sizeof(void). Thanks to codemastr.
2004/05/14 Added +a/-a support for PTLink
2004/05/14 Fixed HELP LIST and LIST SYNTAX help messages ( #53 )
diff --git a/Changes.conf b/Changes.conf
index 6e0e6ab5f..6629b825c 100644
--- a/Changes.conf
+++ b/Changes.conf
@@ -2,6 +2,11 @@ Anope Version 1.7.x (will be renamed when next release is produced)
-------------------
** ADDED CONFIGURATION DIRECTIVES **
+# BSCaseSensitive [OPTIONAL]
+# This option will make botserv use cAsE sEnSiTiVe checking for badwords
+
+# BSCaseSensitive
+
# MSMemoReceipt [OPTIONAL]
# Allow the use of memo receipts for the following groups:
# 1 - Opers Only
diff --git a/botserv.c b/botserv.c
index 1134a1736..b8fb4ae12 100644
--- a/botserv.c
+++ b/botserv.c
@@ -295,22 +295,36 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
if (!bw->in_use)
continue;
- if (bw->type == BW_ANY && stristr(nbuf, bw->word)) {
+ if (bw->type == BW_ANY
+ && ((BSCaseSensitive && strstr(nbuf, bw->word))
+ || stristr(nbuf, bw->word))) {
mustkick = 1;
} else if (bw->type == BW_SINGLE) {
int len = strlen(bw->word);
- if (!stricmp(nbuf, bw->word)) {
+ if ((BSCaseSensitive && strstr(nbuf, bw->word))
+ || (!BSCaseSensitive
+ && (!stricmp(nbuf, bw->word)))) {
mustkick = 1;
/* two next if are quite odd isn't it? =) */
} else if ((strchr(nbuf, ' ') == nbuf + len)
- && (stristr(nbuf, bw->word) == nbuf)) {
+ &&
+ ((BSCaseSensitive
+ && (strstr(nbuf, bw->word) == nbuf))
+ || (!BSCaseSensitive
+ && (stristr(nbuf, bw->word) ==
+ nbuf)))) {
mustkick = 1;
} else
if ((strrchr(nbuf, ' ') ==
nbuf + strlen(nbuf) - len - 1)
- && (stristr(nbuf, bw->word) ==
- nbuf + strlen(nbuf) - len)) {
+ &&
+ ((BSCaseSensitive
+ && (strstr(nbuf, bw->word) ==
+ nbuf + strlen(nbuf) - len))
+ || (!BSCaseSensitive
+ && (stristr(nbuf, bw->word) ==
+ nbuf + strlen(nbuf) - len)))) {
mustkick = 1;
} else {
char *wordbuf = scalloc(len + 3, 1);
@@ -320,13 +334,18 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
wordbuf[len + 2] = '\0';
memcpy(wordbuf + 1, bw->word, len);
- if (stristr(nbuf, wordbuf))
+ if ((BSCaseSensitive && (strstr(nbuf, wordbuf)))
+ || (!BSCaseSensitive
+ && (stristr(nbuf, wordbuf))))
mustkick = 1;
}
} else if (bw->type == BW_START) {
int len = strlen(bw->word);
- if (!strnicmp(nbuf, bw->word, len)) {
+ if ((BSCaseSensitive
+ && (!strncmp(nbuf, bw->word, len)))
+ || (!BSCaseSensitive
+ && (!strnicmp(nbuf, bw->word, len)))) {
mustkick = 1;
} else {
char *wordbuf = scalloc(len + 2, 1);
@@ -335,7 +354,9 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
wordbuf[0] = ' ';
wordbuf[len + 1] = '\0';
- if (stristr(nbuf, wordbuf))
+ if ((BSCaseSensitive && (strstr(nbuf, wordbuf)))
+ || (!BSCaseSensitive
+ && (stristr(nbuf, wordbuf))))
mustkick = 1;
free(wordbuf);
@@ -343,8 +364,15 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
} else if (bw->type == BW_END) {
int len = strlen(bw->word);
- if (!strnicmp
- (nbuf + strlen(nbuf) - len, bw->word, len)) {
+ if ((BSCaseSensitive
+ &&
+ (!strncmp
+ (nbuf + strlen(nbuf) - len, bw->word, len)))
+ || (!BSCaseSensitive
+ &&
+ (!strnicmp
+ (nbuf + strlen(nbuf) - len, bw->word,
+ len)))) {
mustkick = 1;
} else {
char *wordbuf = scalloc(len + 2, 1);
@@ -353,7 +381,9 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf)
wordbuf[len] = ' ';
wordbuf[len + 1] = '\0';
- if (stristr(nbuf, wordbuf))
+ if ((BSCaseSensitive && (strstr(nbuf, wordbuf)))
+ || (!BSCaseSensitive
+ && (stristr(nbuf, wordbuf))))
mustkick = 1;
free(wordbuf);
@@ -2331,7 +2361,9 @@ static int do_badwords(User * u)
}
for (bw = ci->badwords, i = 0; i < ci->bwcount; bw++, i++) {
- if (bw->word && !stricmp(bw->word, word)) {
+ if (bw->word &&
+ ((BSCaseSensitive && (!strcmp(bw->word, word)))
+ || (!BSCaseSensitive && (!stricmp(bw->word, word))))) {
notice_lang(s_BotServ, u, BOT_BADWORDS_ALREADY_EXISTS,
bw->word, ci->name);
return MOD_CONT;
diff --git a/config.c b/config.c
index de265736d..b2a4770fb 100644
--- a/config.c
+++ b/config.c
@@ -218,6 +218,7 @@ int BSMinUsers;
int BSBadWordsMax;
int BSSmartJoin;
int BSGentleBWReason;
+int BSCaseSensitive;
int HideStatsO;
int GlobalOnCycle;
@@ -374,6 +375,7 @@ Directive directives[] = {
{"BSDefGreet", {{PARAM_SET, PARAM_RELOAD, &BSDefGreet}}},
{"BSDefFantasy", {{PARAM_SET, PARAM_RELOAD, &BSDefFantasy}}},
{"BSDefSymbiosis", {{PARAM_SET, PARAM_RELOAD, &BSDefSymbiosis}}},
+ {"BSCaseSensitive", {{PARAM_SET, PARAM_RELOAD, &BSCaseSensitive}}},
{"BSGentleBWReason", {{PARAM_SET, PARAM_RELOAD, &BSGentleBWReason}}},
{"BSKeepData", {{PARAM_TIME, PARAM_RELOAD, &BSKeepData}}},
{"BSMinUsers", {{PARAM_POSINT, PARAM_RELOAD, &BSMinUsers}}},
diff --git a/data/example.conf b/data/example.conf
index db83e27f7..12b93d3c4 100644
--- a/data/example.conf
+++ b/data/example.conf
@@ -1010,6 +1010,11 @@ BSKeepData 10m
BSGentleBWReason
+# BSCaseSensitive [OPTIONAL]
+# This option will make botserv use cAsE sEnSiTiVe checking for badwords
+
+# BSCaseSensitive
+
###########################################################################
#
# HostServ configuration
diff --git a/extern.h b/extern.h
index 58ca92f30..3b5b3fd0c 100644
--- a/extern.h
+++ b/extern.h
@@ -354,6 +354,7 @@ E int BSMinUsers;
E int BSBadWordsMax;
E int BSSmartJoin;
E int BSGentleBWReason;
+E int BSCaseSensitive;
E int HideStatsO;
E int GlobalOnCycle;
diff --git a/version.log b/version.log
index d4924a3ff..e80b8e46c 100644
--- a/version.log
+++ b/version.log
@@ -8,11 +8,15 @@
VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="2"
-VERSION_BUILD="104"
+VERSION_BUILD="106"
VERSION_EXTRA=""
# $Log$
#
+# BUILD : 1.7.2 (106)
+# BUGS :
+# NOTES : Added BSCaseSensitive directive for a cAsE sEnSiTiVe badword kicker.
+#
# BUILD : 1.7.2 (104)
# BUGS :
# NOTES : Removed some illegal sizeof(void). Thanks to codemastr.