From ae8341627017a0a1b1e1033c6239b4ebb16e7219 Mon Sep 17 00:00:00 2001 From: w00t Date: Sun, 28 Oct 2007 21:37:22 +0000 Subject: Make ELines cached, and check for ELined status in all the Matches for all the linetypes. Brain, SVN up before you overwrite my fixes to bits of this again :P git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8417 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/xline.cpp | 59 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/xline.cpp b/src/xline.cpp index 9af297e31..7979a1d82 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -137,6 +137,23 @@ bool XLine::Matches(User *u) return false; } +//XXX perhaps move into xlinemanager +void CheckELines(InspIRCd *ServerInstance, std::vector &ELines) +{ + for (std::vector::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) + { + User* u = (User*)(*u2); + + for (std::vector::iterator i = ELines.begin(); i != ELines.end(); i++) + { + ELine *e = (*i); + + u->exempt = e->Matches(u); + } + } +} + + IdentHostPair XLineManager::IdentSplit(const std::string &ident_and_host) { IdentHostPair n = std::make_pair("*","*"); @@ -553,21 +570,6 @@ void XLineManager::expire_lines() } -void CheckELines(InspIRCd *ServerInstance, const std::vector &ELines) -{ - for (std::vector::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) - { - User* u = (User*)(*u2); - - for (std::vector::iterator i = ELines.begin(); i != ELines.end(); i++) - { - ELine *e = (*i); - - u->exempt = e->Matches(u); - } - } -} - // applies lines, removing clients and changing nicks etc as applicable void XLineManager::ApplyLines() { @@ -575,14 +577,6 @@ void XLineManager::ApplyLines() { User* u = (User*)(*u2); - if (elines.size()) - { - // ignore people matching exempts -- XXX cache the exempt state in userrec permanently? - // should be fairly easy to accomplish really, and might achieve some nice gains? - if (matches_exception(u)) - continue; - } - for (std::vector::iterator i = pending_lines.begin(); i != pending_lines.end(); i++) { XLine *x = *i; @@ -633,7 +627,7 @@ XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance) { } -virtual bool Matches(const std::string &str) +bool XLine::Matches(const std::string &str) { return false; } @@ -656,6 +650,9 @@ void XLine::DefaultApply(User* u, char line) bool KLine::Matches(User *u) { + if (u->exempt) + return false; + if ((match(u->ident, this->identmask))) { if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true))) @@ -674,6 +671,9 @@ void KLine::Apply(User* u) bool GLine::Matches(User *u) { + if (u->exempt) + return false; + if ((match(u->ident, this->identmask))) { if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true))) @@ -692,6 +692,9 @@ void GLine::Apply(User* u) bool ELine::Matches(User *u) { + if (u->exempt) + return false; + if ((match(u->ident, this->identmask))) { if ((match(u->host, this->hostmask, true)) || (match(u->GetIPString(), this->hostmask, true))) @@ -705,6 +708,9 @@ bool ELine::Matches(User *u) bool ZLine::Matches(User *u) { + if (u->exempt) + return false; + if (match(u->GetIPString(), this->ipaddr, true)) return true; else @@ -719,7 +725,10 @@ void ZLine::Apply(User* u) bool QLine::Matches(User *u) { - if (match(user->nick, this->nick)) + if (u->exempt) + return false; + + if (match(u->nick, this->nick)) return true; return false; -- cgit v1.2.3