summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB00mX0r <b00mx0r@aureus.pw>2017-11-26 21:46:10 -0800
committerPeter Powell <petpow@saberuk.com>2017-12-11 11:12:01 +0000
commit5076d9d3c4d9cdf9a9124a60e3311d111297d301 (patch)
tree71deb1d5293b748a3da4796f58dc85496f84afdf /src
parentfb4abb7669cbdcec05c79fe78ae9d256dece2dc8 (diff)
Add optional oper override umode +O.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_override.cpp23
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));
}