diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/os_modunload.c | 1 | ||||
-rw-r--r-- | src/module.cpp | 12 | ||||
-rw-r--r-- | src/modulemanager.cpp | 4 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/core/os_modunload.c b/src/core/os_modunload.c index 8fde45fc8..96790357f 100644 --- a/src/core/os_modunload.c +++ b/src/core/os_modunload.c @@ -29,6 +29,7 @@ class OSModUnLoad : public Module this->SetAuthor("Anope"); this->SetVersion("$Id$"); this->SetType(CORE); + this->SetPermanent(true); c = createCommand("MODUNLOAD", do_modunload, is_services_root, -1, -1, -1, -1, OPER_HELP_MODUNLOAD); this->AddCommand(OPERSERV, c, MOD_UNIQUE); diff --git a/src/module.cpp b/src/module.cpp index 08d1a1cf0..7179d8bdf 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -31,6 +31,8 @@ Module::Module(const std::string &mname, const std::string &creator) this->type = THIRD; this->handle = NULL; + this->permanent = false; + for (int i = 0; i < NUM_LANGS; i++) { this->lang[i].argc = 0; @@ -210,6 +212,16 @@ void Module::SetType(MODType ntype) this->type = ntype; } +void Module::SetPermanent(bool state) +{ + this->permanent = state; +} + +bool Module::GetPermanent() +{ + return this->permanent; +} + void Module::SetVersion(const std::string &nversion) { this->version = nversion; diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 529a2e799..2a01351e1 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -229,7 +229,7 @@ int ModuleManager::LoadModule(const std::string &modname, User * u) return MOD_ERR_OK; } -int ModuleManager::UnloadModule(Module * m, User * u) +int ModuleManager::UnloadModule(Module *m, User *u) { if (!m || !m->handle) { @@ -238,7 +238,7 @@ int ModuleManager::UnloadModule(Module * m, User * u) return MOD_ERR_PARAMS; } - if (m->type == PROTOCOL || m->type == ENCRYPTION) + if (m->GetPermanent() || m->type == PROTOCOL || m->type == ENCRYPTION) { if (u) notice_lang(s_OperServ, u, OPER_MODULE_NO_UNLOAD); |