]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_loadmodule.cpp
Allow configuring whether SETNAME sends snotices and is oper-only.
[user/henk/code/inspircd.git] / src / coremods / core_loadmodule.cpp
index 69c6bbcef2dd24e86bc1b1ca0b1b4054601b9e7f..faecab2135cbdef966154cef295bfdb6301cd1a7 100644 (file)
@@ -58,10 +58,13 @@ CmdResult CommandLoadmodule::Handle(User* user, const Params& parameters)
 class CommandUnloadmodule : public Command
 {
  public:
+       bool allowcoreunload;
+
        /** Constructor for unloadmodule.
         */
        CommandUnloadmodule(Module* parent)
-               : Command(parent,"UNLOADMODULE", 1)
+               : Command(parent, "UNLOADMODULE", 1)
+               , allowcoreunload(false)
        {
                flags_needed = 'o';
                syntax = "<modulename>";
@@ -77,8 +80,7 @@ class CommandUnloadmodule : public Command
 
 CmdResult CommandUnloadmodule::Handle(User* user, const Params& parameters)
 {
-       if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") &&
-               InspIRCd::Match(parameters[0], "core_*.so", ascii_case_insensitive_map))
+       if (!allowcoreunload && InspIRCd::Match(parameters[0], "core_*.so", ascii_case_insensitive_map))
        {
                user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "You cannot unload core commands!");
                return CMD_FAILURE;
@@ -120,6 +122,12 @@ class CoreModLoadModule : public Module
        {
                return Version("Provides the LOADMODULE and UNLOADMODULE commands", VF_VENDOR|VF_CORE);
        }
+
+       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
+       {
+               ConfigTag* tag = ServerInstance->Config->ConfValue("security");
+               cmdunloadmod.allowcoreunload = tag->getBool("allowcoreunload");
+       }
 };
 
 MODULE_INIT(CoreModLoadModule)