1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
17 #include "command_parse.h"
19 /* All other ircds when doing this check usually just look for a string of *@* or *. We're smarter than that, though. */
21 bool InspIRCd::HostMatchesEveryone(const std::string &mask, userrec* user)
23 char itrigger[MAXBUF];
26 if (!Config->ConfValue(Config->config_data, "insane","trigger", 0, itrigger, MAXBUF))
27 strlcpy(itrigger,"95.5",MAXBUF);
29 if (Config->ConfValueBool(Config->config_data, "insane","hostmasks", 0))
32 for (user_hash::iterator u = clientlist->begin(); u != clientlist->end(); u++)
34 if ((match(u->second->MakeHost(),mask.c_str(),true)) || (match(u->second->MakeHostIP(),mask.c_str(),true)))
43 float percent = ((float)matches / (float)clientlist->size()) * 100;
44 if (percent > (float)atof(itrigger))
46 WriteOpers("*** \2WARNING\2: %s tried to set a G/K/E line mask of %s, which covers %.2f%% of the network!",user->nick,mask.c_str(),percent);
52 bool InspIRCd::IPMatchesEveryone(const std::string &ip, userrec* user)
54 char itrigger[MAXBUF];
57 if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
58 strlcpy(itrigger,"95.5",MAXBUF);
60 if (Config->ConfValueBool(Config->config_data, "insane","ipmasks",0))
63 for (user_hash::iterator u = clientlist->begin(); u != clientlist->end(); u++)
65 if (match(u->second->GetIPString(),ip.c_str(),true))
72 float percent = ((float)matches / (float)clientlist->size()) * 100;
73 if (percent > (float)atof(itrigger))
75 WriteOpers("*** \2WARNING\2: %s tried to set a Z line mask of %s, which covers %.2f%% of the network!",user->nick,ip.c_str(),percent);
81 bool InspIRCd::NickMatchesEveryone(const std::string &nick, userrec* user)
83 char itrigger[MAXBUF];
86 if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
87 strlcpy(itrigger,"95.5",MAXBUF);
89 if (Config->ConfValueBool(Config->config_data, "insane","nickmasks",0))
92 for (user_hash::iterator u = clientlist->begin(); u != clientlist->end(); u++)
94 if (match(u->second->nick,nick.c_str()))
101 float percent = ((float)matches / (float)clientlist->size()) * 100;
102 if (percent > (float)atof(itrigger))
104 WriteOpers("*** \2WARNING\2: %s tried to set a Q line mask of %s, which covers %.2f%% of the network!",user->nick,nick.c_str(),percent);