diff options
author | Peter Powell <petpow@saberuk.com> | 2017-12-11 11:14:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 11:14:25 +0000 |
commit | eba2c5ffd3bdea18cc83df12512aba33b5a734a7 (patch) | |
tree | 323349ab4716cad68b274912144d50774e52678b /src/modules | |
parent | 6f3cf8aaa60bc4ab9e48520db26cd8e46360f6bf (diff) | |
parent | 5076d9d3c4d9cdf9a9124a60e3311d111297d301 (diff) |
Merge pull request #1423 from B00mX0r/master+override_umode
Add optional oper override umode +O.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_override.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index cb36b3f51..7155e7e76 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -27,10 +27,23 @@ #include "inspircd.h" #include "modules/invite.h" +class Override : public SimpleUserModeHandler +{ + public: + Override(Module* Creator) : SimpleUserModeHandler(Creator, "override", 'O') + { + oper = true; + if (!ServerInstance->Config->ConfValue("override")->getBool("enableumode")) + DisableAutoRegister(); + } +}; + class ModuleOverride : public Module { bool RequireKey; bool NoisyOverride; + bool UmodeEnabled; + Override ou; ChanModeReference topiclock; ChanModeReference inviteonly; ChanModeReference key; @@ -65,7 +78,9 @@ class ModuleOverride : public Module public: ModuleOverride() - : topiclock(this, "topiclock") + : UmodeEnabled(false) + , ou(this) + , topiclock(this, "topiclock") , inviteonly(this, "inviteonly") , key(this, "key") , limit(this, "limit") @@ -76,6 +91,7 @@ class ModuleOverride : public Module void init() CXX11_OVERRIDE { ServerInstance->SNO->EnableSnomask('v', "OVERRIDE"); + UmodeEnabled = ServerInstance->Config->ConfValue("override")->getBool("enableumode"); } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE @@ -93,8 +109,11 @@ class ModuleOverride : public Module bool CanOverride(User* source, const char* token) { - std::string tokenlist = source->oper->getConfig("override"); + // If we require oper override umode (+O) but it is not set + if (UmodeEnabled && !source->IsModeSet(ou)) + return false; + std::string tokenlist = source->oper->getConfig("override"); // its defined or * is set, return its value as a boolean for if the token is set return ((tokenlist.find(token, 0) != std::string::npos) || (tokenlist.find("*", 0) != std::string::npos)); } |