From aa66651cdc6e3aee74e8f0ed2c064fc3daa3fd05 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 10 Feb 2007 21:47:42 +0000 Subject: 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 --- src/commands.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') 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)) { -- cgit v1.2.3