From ebbc4b3d54e3176d6c4c77493cb5cc0157b5c006 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 2 Nov 2007 15:52:34 +0000 Subject: Expire timed glines that are due for expiry on stats request for it, thanks for the idea danieldg git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8464 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/xline.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/xline.cpp b/src/xline.cpp index 028067794..b41b69c89 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -275,25 +275,33 @@ void XLineManager::ApplyLines() pending_lines.clear(); } -/* k: 216 - * g: 223 - * q: 217 - * z: 223 - * e: 223 - */ - void XLineManager::InvokeStats(const std::string &type, int numeric, User* user, string_list &results) { std::string sn = ServerInstance->Config->ServerName; ContainerIter n = lookup_lines.find(type); + time_t current = ServerInstance->Time(); + + LookupIter safei; + if (n != lookup_lines.end()) { XLineLookup& list = n->second; - for (LookupIter i = list.begin(); i != list.end(); i++) - results.push_back(sn+" "+ConvToStr(numeric)+" "+user->nick+" :"+i->second->Displayable()+" "+ + for (LookupIter i = list.begin(); i != list.end(); ) + { + safei = i; + safei++; + + if (current > i->second->expiry) + { + ExpireLine(n, i); + } + else + results.push_back(sn+" "+ConvToStr(numeric)+" "+user->nick+" :"+i->second->Displayable()+" "+ ConvToStr(i->second->set_time)+" "+ConvToStr(i->second->duration)+" "+std::string(i->second->source)+" :"+(i->second->reason)); + i = safei; + } } } -- cgit v1.2.3