diff options
author | Sadie Powell <sadie@witchery.services> | 2021-02-21 04:09:59 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-02-21 04:09:59 +0000 |
commit | 6f4aee365b5af9a9c6f733be8dbfc3365d15a866 (patch) | |
tree | 0e434564da4799e064efb70f82f90d22a996b2b6 /src | |
parent | b45b7f018d49eeeada7ece3d05382798bbcd55e4 (diff) |
Add a config option for exempting classes from connflood.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_connflood.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 809055a5a..fe581e072 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -27,6 +27,7 @@ class ModuleConnFlood : public Module { + private: unsigned int seconds; unsigned int timeout; unsigned int boot_wait; @@ -36,6 +37,16 @@ class ModuleConnFlood : public Module time_t first; std::string quitmsg; + static bool IsExempt(LocalUser* user) + { + // E-lined and already banned users shouldn't be hit. + if (user->exempt || user->quitting) + return true; + + // Users in an exempt class shouldn't be hit. + return user->GetClass() && !user->GetClass()->config->getBool("useconnflood", true); + } + public: ModuleConnFlood() : conns(0), throttled(false) @@ -65,7 +76,7 @@ public: ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE { - if (user->exempt) + if (IsExempt(user)) return MOD_RES_PASSTHRU; time_t next = ServerInstance->Time(); |