summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-10 21:47:42 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-10 21:47:42 +0000
commitaa66651cdc6e3aee74e8f0ed2c064fc3daa3fd05 (patch)
treebf194c9ffd76d572c689e43ef03f6444ff3c2aaa /src
parent3681528e5a13c4e85b7276def209a2d6e73f4d2e (diff)
Tweak hostname matching in HostMatchesEveryone to compensate for being able to match all 3 of host and ip and CIDR
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6569 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 15070abdf..c31885483 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -114,9 +114,15 @@ bool InspIRCd::HostMatchesEveryone(const std::string &mask, userrec* user)
for (user_hash::iterator u = clientlist->begin(); u != clientlist->end(); u++)
{
- if (match(u->second->MakeHost(),mask.c_str()),true)
+ if ((match(u->second->MakeHost(),mask.c_str(),true)) || (match(u->second->MakeHostIP(),mask.c_str(),true)))
+ {
matches++;
+ }
}
+
+ if (!matches)
+ return false;
+
float percent = ((float)matches / (float)clientlist->size()) * 100;
if (percent > (float)atof(itrigger))
{
@@ -142,7 +148,10 @@ bool InspIRCd::IPMatchesEveryone(const std::string &ip, userrec* user)
if (match(u->second->GetIPString(),ip.c_str(),true))
matches++;
}
-
+
+ if (!matches)
+ return false;
+
float percent = ((float)matches / (float)clientlist->size()) * 100;
if (percent > (float)atof(itrigger))
{
@@ -168,7 +177,10 @@ bool InspIRCd::NickMatchesEveryone(const std::string &nick, userrec* user)
if (match(u->second->nick,nick.c_str()))
matches++;
}
-
+
+ if (!matches)
+ return false;
+
float percent = ((float)matches / (float)clientlist->size()) * 100;
if (percent > (float)atof(itrigger))
{