summaryrefslogtreecommitdiff
path: root/src/module.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-28 22:44:34 -0400
committerAdam <Adam@anope.org>2011-05-16 04:09:32 -0400
commit583954d3a1db658281a9afb7b7dd6773726c8c11 (patch)
tree6a00865d5738c6d0bc42efb35f3f468c5876eb3e /src/module.cpp
parent8fb1604f649bec6f356770daf5df6bb8ab811bbf (diff)
Use module type to determine what type each module is instead of its location in the configuration file.
Diffstat (limited to 'src/module.cpp')
-rw-r--r--src/module.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/module.cpp b/src/module.cpp
index eadfbf4d1..929984e2e 100644
--- a/src/module.cpp
+++ b/src/module.cpp
@@ -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;