]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/bancache.h
Add an overridden AddHit to BanCacheManager, allowing the expiry time to be set.
[user/henk/code/inspircd.git] / include / bancache.h
index 75d1a67b5b765e93a748c6a6de88a495e764cf21..5ce8193b6d4a4796cc2f98bcb79f1dc7a5e9f28b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -34,6 +34,16 @@ class CoreExport BanCacheHit : public classbase
                this->IP = ip;
                this->Expiry = time(NULL) + 60; // XXX changeme
        }
+
+       // overridden to allow custom time
+       BanCacheHit(InspIRCd *Instance, const std::string &ip, const std::string &type, const std::string &reason, time_t seconds)
+       {
+               ServerInstance = Instance;
+               this->Type = type;
+               this->Reason = reason;
+               this->IP = ip;
+               this->Expiry = time(NULL) + seconds;
+       }
 };
 
 // must be defined after class BanCacheHit.
@@ -56,6 +66,9 @@ class CoreExport BanCacheManager : public classbase
         * @param reason The reason for the ban. Left .empty() if it's a negative match.
         */
        BanCacheHit *AddHit(const std::string &ip, const std::string &type, const std::string &reason);
+
+       // Overridden to allow an optional number of seconds before expiry
+       BanCacheHit *AddHit(const std::string &ip, const std::string &type, const std::string &reason, time_t seconds);
        BanCacheHit *GetHit(const std::string &ip);
        bool RemoveHit(BanCacheHit *b);