diff options
author | Daniel Vassdal <shutter@canternet.org> | 2013-12-12 13:39:10 -0800 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2013-12-14 19:34:21 +0100 |
commit | 4b9d53b05207cca559f24e098d50c43811fcf176 (patch) | |
tree | 23abf975333093ad26ea59b7dae196cfe9cc20de /src/modules/m_override.cpp | |
parent | bc4177ad010d0db5248fd49db1498d67119d709a (diff) |
Fix m_override refusing to override modes if the user holds halfop or higher in the channel
Diffstat (limited to 'src/modules/m_override.cpp')
-rw-r--r-- | src/modules/m_override.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 1d9447fc4..3e42c4f79 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -33,6 +33,20 @@ class ModuleOverride : public Module bool RequireKey; bool NoisyOverride; + static bool IsOverride(unsigned int userlevel, const std::string& modeline) + { + for (std::string::const_iterator i = modeline.begin(); i != modeline.end(); ++i) + { + ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL); + if (!mh) + continue; + + if (mh->GetLevelRequired() > userlevel) + return true; + } + return false; + } + public: void init() @@ -105,7 +119,10 @@ class ModuleOverride : public Module unsigned int mode = channel->GetPrefixValue(source); - if (mode < HALFOP_VALUE && CanOverride(source, "MODE")) + if (!IsOverride(mode, parameters[1])) + return MOD_RES_PASSTHRU; + + if (CanOverride(source, "MODE")) { std::string msg = source->nick+" overriding modes:"; for(unsigned int i=0; i < parameters.size(); i++) |