diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-11-17 23:59:39 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-11-17 23:59:39 +0000 |
commit | 12ec2bc108e0f0219792cbbe78a6ce7d86818fe3 (patch) | |
tree | 6ed8d353372f20469e3c3aecd86e301784de4203 /src/bancache.cpp | |
parent | 409b55e4425042d0e5a047af296ffbc2514e6192 (diff) |
It compiles; ship it.
(add some sort of working skeleton for BanCacheManager::RemoveEntries().)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8600 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/bancache.cpp')
-rw-r--r-- | src/bancache.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/bancache.cpp b/src/bancache.cpp index b4fccbbf8..05c014de3 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -65,7 +65,36 @@ bool BanCacheManager::RemoveHit(BanCacheHit *b) int BanCacheManager::RemoveEntries(const std::string &type, bool positive) { - return 0; + int removed = 0; + + BanCacheHash::iterator safei; + + for (BanCacheHash::iterator n = BanHash->begin(); n != BanHash->end(); ) + { + safei = n; + safei++; + + BanCacheHit *b = n->second; + + /* Safe to delete items here through iterator 'n' */ + if (b->Type == type) + { + if ((positive && !b->Reason.empty()) || b->Reason.empty()) + { + /* we need to remove this one. */ + delete b; + b = NULL; + BanHash->erase(n); + removed++; + } + } + + /* End of safe section */ + n = safei; + } + + + return removed; } void BanCacheManager::RehashCache() |