X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fxline.cpp;h=268804f9dce804981a14f4f9e700e6746ffef23b;hb=8509727e16f1d9ce6c9719c8d62c7715d3699858;hp=dc054dc706ac78614d05fd03187ca2d5e9d83057;hpb=64fec23cc76f86650860a24e5dae1d49e27f9111;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/xline.cpp b/src/xline.cpp index dc054dc70..268804f9d 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -70,7 +70,7 @@ void XLineManager::CheckELines() if (ELines.empty()) return; - for (std::vector::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) + for (std::vector::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++) { User* u = (User*)(*u2); @@ -151,7 +151,7 @@ bool XLineManager::AddLine(XLine* line, User* user) { /*IdentHostPair ih = IdentSplit(hostmask);*/ - ServerInstance->BanCache->RemoveEntries(line->type, true); + ServerInstance->BanCache->RemoveEntries(line->type, false); // XXX perhaps remove ELines here? if (DelLine(line->Displayable(), line->type, user, true)) return false; @@ -183,7 +183,7 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User* if (simulate) return true; - ServerInstance->BanCache->RemoveEntries(y->second->type, false); + ServerInstance->BanCache->RemoveEntries(y->second->type, true); FOREACH_MOD(I_OnDelLine,OnDelLine(user, y->second)); @@ -203,7 +203,7 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User* void ELine::Unset() { /* 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++) + for (std::vector::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++) { User* u = (User*)(*u2); u->exempt = false; @@ -289,26 +289,28 @@ XLine* XLineManager::MatchesLine(const std::string &type, const std::string &pat // removes lines that have expired void XLineManager::ExpireLine(ContainerIter container, LookupIter item) { - item->second->DisplayExpiry(); - item->second->Unset(); + FOREACH_MOD(I_OnExpireLine, OnExpireLine(item->second)); - /* TODO: Can we skip this loop by having a 'pending' field in the XLine class, which is set when a line - * is pending, cleared when it is no longer pending, so we skip over this loop if its not pending? - * -- Brain - */ - std::vector::iterator pptr = std::find(pending_lines.begin(), pending_lines.end(), item->second); - if (pptr != pending_lines.end()) - pending_lines.erase(pptr); + item->second->DisplayExpiry(); + item->second->Unset(); - delete item->second; - container->second.erase(item); + /* TODO: Can we skip this loop by having a 'pending' field in the XLine class, which is set when a line + * is pending, cleared when it is no longer pending, so we skip over this loop if its not pending? + * -- Brain + */ + std::vector::iterator pptr = std::find(pending_lines.begin(), pending_lines.end(), item->second); + if (pptr != pending_lines.end()) + pending_lines.erase(pptr); + + delete item->second; + container->second.erase(item); } // 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++) + for (std::vector::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++) { User* u = (User*)(*u2); @@ -534,7 +536,7 @@ bool GLine::Matches(const std::string &str) void ELine::OnAdd() { /* When adding one eline, only check the one eline */ - for (std::vector::const_iterator u2 = ServerInstance->local_users.begin(); u2 != ServerInstance->local_users.end(); u2++) + for (std::vector::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++) { User* u = (User*)(*u2); if (this->Matches(u)) @@ -620,7 +622,7 @@ XLineFactory* XLineManager::GetFactory(const std::string &type) { XLineFactMap::iterator n = line_factory.find(type); - if (n != line_factory.end()) + if (n == line_factory.end()) return NULL; return n->second;