1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 00:43:12 +02:00

Add Module::SetPermanent() and Module::GetPermanent(), used to mark a module as not unloadable.

Used for os_modunload, as unloading it would cause issues.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1679 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
rburchell
2008-11-14 20:28:23 +00:00
parent 10dcb3d8a4
commit bb47ab8f41
5 changed files with 32 additions and 3 deletions
+1
View File
@@ -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);
+12
View File
@@ -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;
+2 -2
View File
@@ -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);