unsigned int minlen;
char capsmap[256];
public:
-
+
ModuleBlockCAPS(InspIRCd* Me) : Module(Me)
{
OnRehash(NULL,"");
{
int caps = 0;
const char* actstr = "\1ACTION ";
+ int act = 0;
for (std::string::iterator i = text.begin(); i != text.end(); i++)
{
/* Smart fix for suggestion from Jobe, ignore CTCP ACTION (part of /ME) */
- if (*actstr && *i == *actstr++)
+ if (*actstr && *i == *actstr++ && act != -1)
+ {
+ act++;
continue;
+ }
+ else
+ act = -1;
caps += capsmap[(unsigned char)*i];
}
if ( ((caps*100)/(int)text.length()) >= percent )
{
- user->WriteServ( "404 %s %s :Your line cannot be more than %d%% capital letters if it is %d or more letters long", user->nick, c->name, percent, minlen);
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Your line cannot be more than %d%% capital letters if it is %d or more letters long", user->nick.c_str(), c->name.c_str(), percent, minlen);
return 1;
}
}
std::string hmap = Conf.ReadValue("blockcaps", "capsmap", 0);
if (hmap.empty())
hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- memset(&capsmap, 0, 255);
+ memset(capsmap, 0, sizeof(capsmap));
for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
capsmap[(unsigned char)*n] = 1;
if (percent < 1 || percent > 100)