mirror of
https://github.com/anope/anope.git
synced 2026-06-29 14:56:37 +02:00
Use module type to determine what type each module is instead of its location in the configuration file.
This commit is contained in:
+9
-14
@@ -12,21 +12,19 @@
|
||||
# include <libintl.h>
|
||||
#endif
|
||||
|
||||
Module::Module(const Anope::string &mname, const Anope::string &creator)
|
||||
Module::Module(const Anope::string &modname, const Anope::string &, ModType modtype) : name(modname), type(modtype)
|
||||
{
|
||||
this->name = mname; /* Our name */
|
||||
this->type = THIRD;
|
||||
this->handle = NULL;
|
||||
|
||||
this->permanent = false;
|
||||
|
||||
if (FindModule(this->name))
|
||||
throw CoreException("Module already exists!");
|
||||
|
||||
this->created = Anope::CurTime;
|
||||
|
||||
this->SetVersion(Anope::Version());
|
||||
|
||||
if (ModuleManager::FindModule(this->name))
|
||||
throw CoreException("Module already exists!");
|
||||
|
||||
if (nothird && modtype == THIRD)
|
||||
throw ModuleException("Third party modules may not be loaded");
|
||||
|
||||
Modules.push_back(this);
|
||||
|
||||
#if GETTEXT_FOUND
|
||||
@@ -37,6 +35,8 @@ Module::Module(const Anope::string &mname, const Anope::string &creator)
|
||||
|
||||
Module::~Module()
|
||||
{
|
||||
if (DNSEngine)
|
||||
DNSEngine->Cleanup(this);
|
||||
/* Detach all event hooks for this module */
|
||||
ModuleManager::DetachAll(this);
|
||||
/* Clear any active callbacks this module has */
|
||||
@@ -47,11 +47,6 @@ Module::~Module()
|
||||
Modules.erase(it);
|
||||
}
|
||||
|
||||
void Module::SetType(MODType ntype)
|
||||
{
|
||||
this->type = ntype;
|
||||
}
|
||||
|
||||
void Module::SetPermanent(bool state)
|
||||
{
|
||||
this->permanent = state;
|
||||
|
||||
Reference in New Issue
Block a user