diff options
-rw-r--r-- | docs/conf/modules.conf.example | 15 | ||||
-rw-r--r-- | src/modules/m_override.cpp | 23 |
2 files changed, 34 insertions, 4 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index e5fbab7e0..7c5b0b6e8 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1384,8 +1384,19 @@ # #-#-#-#-#-#-#-#-#-#-# OVERRIDE CONFIGURATION -#-#-#-#-#-#-#-#-#-#-# # # -# override is too complex it describe here, see the wiki: # -# http://wiki.inspircd.org/Modules/override # +# Much of override's configuration relates to your oper blocks. # +# For more information on how to allow opers to override, see: # +# https://wiki.inspircd.org/Modules/3.0/override # +# # +# noisy - If enabled, all oper overrides will be announced # +# via channel notice. # +# # +# requirekey - If enabled, overriding on join requires a channel # +# key of "override" to be specified # +# # +# enableumode - If enabled, usermode +O is required for override. # +# # +#<override noisy="yes" requirekey="no" enableumode="true"> #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Oper levels module: Gives each oper a level and prevents actions 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)); } |