diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-28 21:23:07 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-28 21:23:07 +0000 |
commit | 7dbd30b89c18f212041582f6638f2ae1b62a5b4d (patch) | |
tree | 093324aa298d1e77ec62f232da94285d6109306a /src/xline.cpp | |
parent | e8df3f491d67bc520f808c8b9ebfb54cfc1cce74 (diff) |
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
Diffstat (limited to 'src/xline.cpp')
-rw-r--r-- | src/xline.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
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<User*>::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<User*>::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) + { + User* u = (User*)(*u2); + for (std::vector<ELine *>::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<User*>::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; |