void XLineManager::ApplyLines()
{
const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
- for (UserManager::LocalList::const_iterator j = list.begin(); j != list.end(); ++j)
+ for (UserManager::LocalList::const_iterator j = list.begin(); j != list.end(); )
{
- LocalUser* u = *j;
+ LocalUser* u = *j++;
// Don't ban people who are exempt.
if (u->exempt)
{
XLine *x = *i;
if (x->Matches(u))
+ {
x->Apply(u);
+
+ // If applying the X-line has killed the user then don't
+ // apply any more lines to them.
+ if (u->quitting)
+ break;
+ }
}
}
if (bancache)
{
ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString());
- ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, this->duration);
+ ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, (this->duration > 0 ? (this->expiry - ServerInstance->Time()) : 0));
}
}