X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_loadmodule.cpp;h=faecab2135cbdef966154cef295bfdb6301cd1a7;hb=a032cd90ad5582914759e226085efee5aae1a1ef;hp=69c6bbcef2dd24e86bc1b1ca0b1b4054601b9e7f;hpb=77730fd5f09f8fc193205654c8bba84d34365670;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_loadmodule.cpp b/src/coremods/core_loadmodule.cpp index 69c6bbcef..faecab213 100644 --- a/src/coremods/core_loadmodule.cpp +++ b/src/coremods/core_loadmodule.cpp @@ -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 = ""; @@ -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)