diff options
author | attilamolnar <attilamolnar@hush.com> | 2012-10-01 00:48:00 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-04-10 19:27:23 +0200 |
commit | c5d1a7843ed016c374b21242fccaca47e04b5a37 (patch) | |
tree | 1756805c49afd1c22e68e22270ea463d8992784d /src/bancache.cpp | |
parent | ca0083cba90c8830f5018b73eb715665a8db9dd7 (diff) |
BanCache: Don't repeat ourselves, one BanCacheManager::AddHit() and one BanCacheHit constructor is enough
Diffstat (limited to 'src/bancache.cpp')
-rw-r--r-- | src/bancache.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/bancache.cpp b/src/bancache.cpp index 52449e55e..72f8728d3 100644 --- a/src/bancache.cpp +++ b/src/bancache.cpp @@ -23,19 +23,6 @@ #include "inspircd.h" #include "bancache.h" -BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &type, const std::string &reason) -{ - BanCacheHit *b; - - if (this->BanHash->find(ip) != this->BanHash->end()) // can't have two cache entries on the same IP, sorry.. - return NULL; - - b = new BanCacheHit(ip, type, reason); - - this->BanHash->insert(std::make_pair(ip, b)); - return b; -} - BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &type, const std::string &reason, time_t seconds) { BanCacheHit *b; @@ -43,7 +30,7 @@ BanCacheHit *BanCacheManager::AddHit(const std::string &ip, const std::string &t if (this->BanHash->find(ip) != this->BanHash->end()) // can't have two cache entries on the same IP, sorry.. return NULL; - b = new BanCacheHit(ip, type, reason, seconds); + b = new BanCacheHit(ip, type, reason, (seconds ? seconds : 86400)); this->BanHash->insert(std::make_pair(ip, b)); return b; |