From: w00t Date: Sat, 12 Jul 2008 10:53:31 +0000 (+0000) Subject: Add XLineManager::DelAll to delete all lines of a given type. X-Git-Tag: v2.0.23~2964 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=8f0b1082d8eb9927ab2fdb8e00328df69d198c9a;p=user%2Fhenk%2Fcode%2Finspircd.git Add XLineManager::DelAll to delete all lines of a given type. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9975 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/include/xline.h b/include/xline.h index d1fe0e882..4be5922d0 100644 --- a/include/xline.h +++ b/include/xline.h @@ -517,6 +517,10 @@ class CoreExport XLineManager : public classbase */ XLineLookup* GetAll(const std::string &type); + /** Remove all lines of a certain type. + */ + void DelAll(const std::string &type); + /** Return all known types of line currently stored by the XLineManager. * @return A vector containing all known line types currently stored in the main list. */ diff --git a/src/xline.cpp b/src/xline.cpp index 5d5a95516..0878ec286 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -116,6 +116,22 @@ XLineLookup* XLineManager::GetAll(const std::string &type) return &(n->second); } +void XLineManager::DelAll(const std::string &type) +{ + ContainerIter n = lookup_lines.find(type); + + if (n == lookup_lines.end()) + return; + + LookupIter x; + + /* Delete all of a given type (this should probably use DelLine, but oh well) */ + while ((x = n->second.begin()) != n->second.end()) + { + ExpireLine(n, x); + } +} + std::vector XLineManager::GetAllTypes() { std::vector items;