/* * Checks what users match a given vector of ELines and sets their ban exempt flag accordingly. */ void XLineManager::CheckELines() { ContainerIter n = lookup_lines.find("E"); if (n == lookup_lines.end()) return; XLineLookup& ELines = n->second; if (ELines.empty()) return; for (LocalUserList::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++) { LocalUser* u = *u2; /* This uses safe iteration to ensure that if a line expires here, it doenst trash the iterator */ LookupIter safei; for (LookupIter i = ELines.begin(); i != ELines.end(); ) { safei = i; safei++; XLine *e = i->second; u->exempt = e->Matches(u); i = safei; } } }
// applies lines, removing clients and changing nicks etc as applicable void XLineManager::ApplyLines() { for (std::vector<User*>::const_iterator u2 = ServerInstance->Users->local_users.begin(); u2 != ServerInstance->Users->local_users.end(); u2++) { User* u = (User*)(*u2); // Don't ban people who are exempt. if (u->exempt) continue; for (std::vector<XLine *>::iterator i = pending_lines.begin(); i != pending_lines.end(); i++) { XLine *x = *i; if (x->Matches(u)) x->Apply(u); } } pending_lines.clear(); }
// applies lines, removing clients and changing nicks etc as applicable void XLineManager::ApplyLines() { LocalUserList::reverse_iterator u2 = ServerInstance->Users->local_users.rbegin(); while (u2 != ServerInstance->Users->local_users.rend()) { LocalUser* u = *u2++; // Don't ban people who are exempt. if (u->exempt) continue; for (std::vector<XLine *>::iterator i = pending_lines.begin(); i != pending_lines.end(); i++) { XLine *x = *i; if (x->Matches(u)) x->Apply(u); } } pending_lines.clear(); }