X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fxline.cpp;h=0424e7a09ff7482f73c2b2ab0a8f3fe8cb25a5c9;hb=54e04fe36a275d1791595fe2cdf956d92bb671d7;hp=c9e6f0a85430e5e9e246fcc831dbea3c460fac78;hpb=fd820825ac669c9cd8cc8b7a69ca855159b0d3cb;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/xline.cpp b/src/xline.cpp index c9e6f0a85..0424e7a09 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -3,7 +3,7 @@ * +------------------------------------+ * * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -18,7 +18,7 @@ #include "bancache.h" /* - * This is now version 3 of the XLine subsystem, let's see if we can get it as nice and + * This is now version 3 of the XLine subsystem, let's see if we can get it as nice and * efficient as we can this time so we can close this file and never ever touch it again .. * * Background: @@ -167,17 +167,17 @@ bool XLineManager::AddLine(XLine* line, User* user) { ServerInstance->BanCache->RemoveEntries(line->type, false); // XXX perhaps remove ELines here? - /* If the line exists, check if its an expired line */ + if (line->duration && ServerInstance->Time() > line->expiry) + return false; // Don't apply expired XLines. + + /* Don't apply duplicate xlines */ ContainerIter x = lookup_lines.find(line->type); if (x != lookup_lines.end()) { LookupIter i = x->second.find(line->Displayable()); if (i != x->second.end()) { - if (i->second->duration && ServerInstance->Time() > i->second->expiry) - ExpireLine(x, i); - else - return false; + return false; } } @@ -192,7 +192,7 @@ bool XLineManager::AddLine(XLine* line, User* user) lookup_lines[line->type][line->Displayable()] = line; line->OnAdd(); - FOREACH_MOD(I_OnAddLine,OnAddLine(user, line)); + FOREACH_MOD(I_OnAddLine,OnAddLine(user, line)); return true; } @@ -342,6 +342,10 @@ void XLineManager::ApplyLines() { User* u = (User*)(*u2); + // Don't ban people who are exempt. + if (u->exempt) + continue; + for (std::vector::iterator i = pending_lines.begin(); i != pending_lines.end(); i++) { XLine *x = *i; @@ -423,7 +427,7 @@ XLineManager::~XLineManager() i->second.clear(); } lookup_lines.clear(); - + } void XLine::Apply(User* u) @@ -498,7 +502,7 @@ bool GLine::Matches(User *u) } void GLine::Apply(User* u) -{ +{ DefaultApply(u, "G", (strcmp(this->identmask, "*") == 0) ? true : false); } @@ -531,7 +535,7 @@ bool ZLine::Matches(User *u) } void ZLine::Apply(User* u) -{ +{ DefaultApply(u, "Z", true); } @@ -545,7 +549,7 @@ bool QLine::Matches(User *u) } void QLine::Apply(User* u) -{ +{ /* Force to uuid on apply of qline, no need to disconnect any more :) */ u->ForceNickChange(u->uuid.c_str()); } @@ -595,27 +599,27 @@ void ELine::OnAdd() void ELine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired E-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,ServerInstance->Time() - this->set_time); + ServerInstance->SNO->WriteToSnoMask('x',"Removing expired E-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,(long int)(ServerInstance->Time() - this->set_time)); } void QLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Q-Line %s (set by %s %ld seconds ago)",this->nick,this->source,ServerInstance->Time() - this->set_time); + ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Q-Line %s (set by %s %ld seconds ago)",this->nick,this->source,(long int)(ServerInstance->Time() - this->set_time)); } void ZLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Z-Line %s (set by %s %ld seconds ago)",this->ipaddr,this->source,ServerInstance->Time() - this->set_time); + ServerInstance->SNO->WriteToSnoMask('x',"Removing expired Z-Line %s (set by %s %ld seconds ago)",this->ipaddr,this->source,(long int)(ServerInstance->Time() - this->set_time)); } void KLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired K-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,ServerInstance->Time() - this->set_time); + ServerInstance->SNO->WriteToSnoMask('x',"Removing expired K-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,(long int)(ServerInstance->Time() - this->set_time)); } void GLine::DisplayExpiry() { - ServerInstance->SNO->WriteToSnoMask('x',"Removing expired G-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,ServerInstance->Time() - this->set_time); + ServerInstance->SNO->WriteToSnoMask('x',"Removing expired G-Line %s@%s (set by %s %ld seconds ago)",this->identmask,this->hostmask,this->source,(long int)(ServerInstance->Time() - this->set_time)); } const char* ELine::Displayable() @@ -681,4 +685,3 @@ XLineFactory* XLineManager::GetFactory(const std::string &type) return n->second; } -