summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 01:39:53 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-06 01:39:53 +0000
commit66d15c4a15d2bfbb2ef6fe22e5ae29f436fcb9ec (patch)
tree783ef9b15bfc73d15539145b941130f12c08ed00
parent627d16303b347fb0ff566866e14d2822afeb4d87 (diff)
Maybe BanCache works now?
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8643 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/bancache.cpp9
-rw-r--r--src/xline.cpp4
2 files changed, 9 insertions, 4 deletions
diff --git a/src/bancache.cpp b/src/bancache.cpp
index e8accb404..472685f08 100644
--- a/src/bancache.cpp
+++ b/src/bancache.cpp
@@ -77,6 +77,11 @@ unsigned int BanCacheManager::RemoveEntries(const std::string &type, bool positi
BanCacheHash::iterator safei;
+ if (positive)
+ ServerInstance->Log(DEBUG, "BanCacheManager::RemoveEntries(): Removing positive hits for " + type);
+ else
+ ServerInstance->Log(DEBUG, "BanCacheManager::RemoveEntries(): Removing negative hits for " + type);
+
for (BanCacheHash::iterator n = BanHash->begin(); n != BanHash->end(); )
{
safei = n;
@@ -85,9 +90,9 @@ unsigned int BanCacheManager::RemoveEntries(const std::string &type, bool positi
BanCacheHit *b = n->second;
/* Safe to delete items here through iterator 'n' */
- if (b->Type == type)
+ if (b->Type == type || !positive) // if removing negative hits, ignore type..
{
- if ((positive && !b->Reason.empty()) || !positive && b->Reason.empty())
+ if ((positive && !b->Reason.empty()) || b->Reason.empty())
{
/* we need to remove this one. */
ServerInstance->Log(DEBUG, "BanCacheManager::RemoveEntries(): Removing a hit on " + b->IP);
diff --git a/src/xline.cpp b/src/xline.cpp
index dc054dc70..49ae04cb7 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -151,7 +151,7 @@ bool XLineManager::AddLine(XLine* line, User* user)
{
/*IdentHostPair ih = IdentSplit(hostmask);*/
- ServerInstance->BanCache->RemoveEntries(line->type, true);
+ ServerInstance->BanCache->RemoveEntries(line->type, false); // XXX perhaps remove ELines here?
if (DelLine(line->Displayable(), line->type, user, true))
return false;
@@ -183,7 +183,7 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User*
if (simulate)
return true;
- ServerInstance->BanCache->RemoveEntries(y->second->type, false);
+ ServerInstance->BanCache->RemoveEntries(y->second->type, true);
FOREACH_MOD(I_OnDelLine,OnDelLine(user, y->second));