From 3c17a07b8e22f32d66de64a92478496ed764dcc2 Mon Sep 17 00:00:00 2001 From: "geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Sat, 7 Oct 2006 12:03:20 +0000 Subject: BUILD : 1.7.15 (1164) BUGS : 607 NOTES : Fixed the BotServ CAPS-kicker; when calculating the percentage, it now ignores all non-alphabetic characters git-svn-id: svn://svn.anope.org/anope/trunk@1164 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@886 5417fbe8-f217-4b02-8779-1006273d7864 --- src/botserv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/botserv.c b/src/botserv.c index 6b40ab3df..dd606952e 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -205,14 +205,22 @@ void botchanmsgs(User * u, ChannelInfo * ci, char *buf) if ((ci->botflags & BS_KICK_CAPS) && ((c = strlen(buf)) >= ci->capsmin)) { int i = 0; + int l = 0; char *s = buf; do { if (isupper(*s)) i++; + else if (islower(*s)) + l++; } while (*s++); - - if (i >= ci->capsmin && i * 100 / c >= ci->capspercent) { + + /* i counts uppercase chars, l counts lowercase chars. Only + * alphabetic chars (so islower || isupper) qualify for the + * percentage of caps to kick for; the rest is ignored. -GD + */ + + if (i >= ci->capsmin && i * 100 / (i + l) >= ci->capspercent) { check_ban(ci, u, TTB_CAPS); bot_kick(ci, u, BOT_REASON_CAPS); return; -- cgit