From 7dbd30b89c18f212041582f6638f2ae1b62a5b4d Mon Sep 17 00:00:00 2001 From: w00t Date: Sun, 28 Oct 2007 21:23:07 +0000 Subject: Update User::exempt all the time we change an E:Line. Brain, can you check I've done this okay, and fix my XXX if you know how? ta. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8416 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/xline.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'src/xline.cpp') diff --git a/src/xline.cpp b/src/xline.cpp index cb905440f..9af297e31 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -189,7 +189,9 @@ bool XLineManager::AddELine(long duration, const char* source, const char* reaso elines.push_back(item); sort(elines.begin(), elines.end(),XLineManager::XSortComparison); - pending_lines.push_back(item); + + // XXX we really only need to check one line (the new one) - this is a bit wasteful! + CheckELines(ServerInstance, elines); return true; } @@ -283,8 +285,16 @@ bool XLineManager::DelELine(const char* hostmask, bool simulate) { if (!simulate) { + /* remove exempt from everyone and force recheck after deleting eline */ + for (std::vector::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) + { + User* u = (User*)(*u2); + u->exempt = false; + } + delete *i; elines.erase(i); + CheckELines(ServerInstance, elines); } return true; } @@ -543,8 +553,22 @@ void XLineManager::expire_lines() } -// applies lines, removing clients and changing nicks etc as applicable +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() { for (std::vector::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) @@ -609,7 +633,7 @@ XLineManager::XLineManager(InspIRCd* Instance) : ServerInstance(Instance) { } -bool XLine::Matches(const std::string &str) +virtual bool Matches(const std::string &str) { return false; } @@ -695,7 +719,7 @@ void ZLine::Apply(User* u) bool QLine::Matches(User *u) { - if (match(u->nick, this->nick)) + if (match(user->nick, this->nick)) return true; return false; -- cgit v1.2.3