- ConfigReader Conf(ServerInstance);
- percent = Conf.ReadInteger("blockcaps", "percent", "100", 0, true);
- minlen = Conf.ReadInteger("blockcaps", "minlen", "0", 0, true);
- if (percent < 0 || percent > 100)
- {
- ServerInstance->Log(DEFAULT, "<blockcaps:percent> out of range, setting to default of 100.");
- percent = 100;
- }
- if (minlen < 0 || minlen > MAXBUF-1)
- {
- ServerInstance->Log(DEFAULT, "<blockcaps:minlen> out of range, setting to default of 0.");
- minlen = 0;
- }
- }
-
- virtual ~ModuleBlockCAPS()
- {
- ServerInstance->Modes->DelMode(bc);
- DELETE(bc);
+ ConfigTag* tag = ServerInstance->Config->ConfValue("blockcaps");
+ percent = tag->getInt("percent", 100, 1, 100);
+ minlen = tag->getInt("minlen", 1, 1, ServerInstance->Config->Limits.MaxLine);
+ std::string hmap = tag->getString("capsmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ memset(capsmap, 0, sizeof(capsmap));
+ for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
+ capsmap[(unsigned char)*n] = 1;