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 * ---------------------------------------------------
15 #include "configreader.h"
20 #include "command_parse.h"
22 /* All other ircds when doing this check usually just look for a string of *@* or *. We're smarter than that, though. */
24 bool InspIRCd::HostMatchesEveryone(const std::string &mask, userrec* user)
26 char itrigger[MAXBUF];
29 if (!Config->ConfValue(Config->config_data, "insane","trigger", 0, itrigger, MAXBUF))
30 strlcpy(itrigger,"95.5",MAXBUF);
32 if (Config->ConfValueBool(Config->config_data, "insane","hostmasks", 0))
35 for (user_hash::iterator u = clientlist->begin(); u != clientlist->end(); u++)
37 if ((match(u->second->MakeHost(),mask.c_str(),true)) || (match(u->second->MakeHostIP(),mask.c_str(),true)))
46 float percent = ((float)matches / (float)clientlist->size()) * 100;
47 if (percent > (float)atof(itrigger))
49 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);
55 bool InspIRCd::IPMatchesEveryone(const std::string &ip, userrec* user)
57 char itrigger[MAXBUF];
60 if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
61 strlcpy(itrigger,"95.5",MAXBUF);
63 if (Config->ConfValueBool(Config->config_data, "insane","ipmasks",0))
66 for (user_hash::iterator u = clientlist->begin(); u != clientlist->end(); u++)
68 if (match(u->second->GetIPString(),ip.c_str(),true))
75 float percent = ((float)matches / (float)clientlist->size()) * 100;
76 if (percent > (float)atof(itrigger))
78 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);
84 bool InspIRCd::NickMatchesEveryone(const std::string &nick, userrec* user)
86 char itrigger[MAXBUF];
89 if (!Config->ConfValue(Config->config_data, "insane","trigger",0,itrigger,MAXBUF))
90 strlcpy(itrigger,"95.5",MAXBUF);
92 if (Config->ConfValueBool(Config->config_data, "insane","nickmasks",0))
95 for (user_hash::iterator u = clientlist->begin(); u != clientlist->end(); u++)
97 if (match(u->second->nick,nick.c_str()))
104 float percent = ((float)matches / (float)clientlist->size()) * 100;
105 if (percent > (float)atof(itrigger))
107 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);