X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fxline.cpp;h=c696e7a3a27603cc4d6106198f7a0b238b157954;hb=43847ec9c7e1a195163eb4c529f1c92fd1ace0a4;hp=0878ec286e5c412bde4d87bd66d4d74ab5b8c0d8;hpb=8f0b1082d8eb9927ab2fdb8e00328df69d198c9a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/xline.cpp b/src/xline.cpp index 0878ec286..c696e7a3a 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team + * InspIRCd: (C) 2002-2009 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -11,10 +11,9 @@ * --------------------------------------------------- */ -/* $Core: libIRCDxline */ +/* $Core */ #include "inspircd.h" -#include "wildcard.h" #include "xline.h" #include "bancache.h" @@ -166,12 +165,21 @@ IdentHostPair XLineManager::IdentSplit(const std::string &ident_and_host) bool XLineManager::AddLine(XLine* line, User* user) { - /*IdentHostPair ih = IdentSplit(hostmask);*/ - ServerInstance->BanCache->RemoveEntries(line->type, false); // XXX perhaps remove ELines here? - if (DelLine(line->Displayable(), line->type, user, true)) - return false; + /* If the line exists, check if its an expired line */ + ContainerIter x = lookup_lines.find(line->type); + if (x != lookup_lines.end()) + { + LookupIter i = x->second.find(line->Displayable()); + if (i != x->second.end()) + { + if (i->second->duration && ServerInstance->Time() > i->second->expiry) + ExpireLine(x, i); + else + return false; + } + } /*ELine* item = new ELine(ServerInstance, ServerInstance->Time(), duration, source, reason, ih.first.c_str(), ih.second.c_str());*/ XLineFactory* xlf = GetFactory(line->type); @@ -458,9 +466,10 @@ bool KLine::Matches(User *u) if (u->exempt) return false; - if ((match(u->ident, this->identmask))) + if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map)) { - if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true))) + if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) || + InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map)) { return true; } @@ -479,9 +488,10 @@ bool GLine::Matches(User *u) if (u->exempt) return false; - if ((match(u->ident, this->identmask))) + if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map)) { - if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true))) + if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) || + InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map)) { return true; } @@ -500,9 +510,10 @@ bool ELine::Matches(User *u) if (u->exempt) return false; - if ((match(u->ident, this->identmask))) + if (InspIRCd::Match(u->ident, this->identmask, ascii_case_insensitive_map)) { - if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true))) + if (InspIRCd::MatchCIDR(u->host, this->hostmask, ascii_case_insensitive_map) || + InspIRCd::MatchCIDR(u->GetIPString(), this->hostmask, ascii_case_insensitive_map)) { return true; } @@ -516,7 +527,7 @@ bool ZLine::Matches(User *u) if (u->exempt) return false; - if (match(u->GetIPString(), this->ipaddr, true)) + if (InspIRCd::MatchCIDR(u->GetIPString(), this->ipaddr)) return true; else return false; @@ -530,10 +541,7 @@ void ZLine::Apply(User* u) bool QLine::Matches(User *u) { - if (u->exempt) - return false; - - if (match(u->nick, this->nick)) + if (InspIRCd::Match(u->nick, this->nick)) return true; return false; @@ -548,7 +556,7 @@ void QLine::Apply(User* u) bool ZLine::Matches(const std::string &str) { - if (match(str, this->ipaddr, true)) + if (InspIRCd::MatchCIDR(str, this->ipaddr)) return true; else return false; @@ -556,7 +564,7 @@ bool ZLine::Matches(const std::string &str) bool QLine::Matches(const std::string &str) { - if (match(str, this->nick)) + if (InspIRCd::Match(str, this->nick)) return true; return false; @@ -564,17 +572,17 @@ bool QLine::Matches(const std::string &str) bool ELine::Matches(const std::string &str) { - return ((match(str, matchtext, true))); + return (InspIRCd::MatchCIDR(str, matchtext)); } bool KLine::Matches(const std::string &str) { - return ((match(str.c_str(), matchtext, true))); + return (InspIRCd::MatchCIDR(str.c_str(), matchtext)); } bool GLine::Matches(const std::string &str) { - return ((match(str, matchtext, true))); + return (InspIRCd::MatchCIDR(str, matchtext)); } void ELine::OnAdd()