]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_disable.cpp
Fix the cloaking module on C++98 compilers.
[user/henk/code/inspircd.git] / src / modules / m_disable.cpp
index 295f31e4f656861fe8e8beec4ef92018ec959c9d..95fcd8b4cb1fe49c90f8905b9fc68dbe2409efef 100644 (file)
@@ -1,7 +1,8 @@
 /*
  * InspIRCd -- Internet Relay Chat Daemon
  *
- *   Copyright (C) 2019 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2019-2020 Sadie Powell <sadie@witchery.services>
+ *   Copyright (C) 2019 Robby <robby@chatbelgie.be>
  *
  * This file is part of InspIRCd.  InspIRCd is free software: you can
  * redistribute it and/or modify it under the terms of the GNU General Public
@@ -54,7 +55,7 @@ class ModuleDisable : public Module
 
                        // Check that the mode actually exists.
                        ModeHandler* mh = ServerInstance->Modes->FindMode(chr, type);
-                       if (!chr)
+                       if (!mh)
                                throw ModuleException(InspIRCd::Format("Nonexistent mode '%c' was specified in <disabled:%s> at %s",
                                        chr, field.c_str(), tag->getTagLocation().c_str()));
 
@@ -92,8 +93,8 @@ class ModuleDisable : public Module
                                throw ModuleException(InspIRCd::Format("Nonexistent command '%s' was specified in <disabled:commands> at %s",
                                        command.c_str(), tag->getTagLocation().c_str()));
 
-                       // Prevent admins from disabling COMMANDS and MODULES for transparency reasons.
-                       if (handler->name == "COMMANDS" || handler->name == "MODULES")
+                       // Prevent admins from disabling MODULES for transparency reasons.
+                       if (handler->name == "MODULES")
                                continue;
 
                        // Disable the command.
@@ -162,8 +163,9 @@ class ModuleDisable : public Module
 
                // The user has tried to change a disabled mode!
                const char* what = mh->GetModeType() == MODETYPE_CHANNEL ? "channel" : "user";
-               WriteLog("%s was blocked from executing the disabled %s mode %c (%s)",
-                       user->GetFullRealHost().c_str(), what, mh->GetModeChar(), mh->name.c_str());
+               WriteLog("%s was blocked from %ssetting the disabled %s mode %c (%s)",
+                       user->GetFullRealHost().c_str(), adding ? "" : "un",
+                       what, mh->GetModeChar(), mh->name.c_str());
 
                if (fakenonexistent)
                {
@@ -182,7 +184,7 @@ class ModuleDisable : public Module
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides support for disabling commands and modes", VF_VENDOR);
+               return Version("Allows commands, channel modes, and user modes to be disabled.", VF_VENDOR);
        }
 };