blob: 98eb9b4fd2fd634f82ceb881a7f08e0ac2a35e4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/* Modular support
*
* (C) 2009 Anope Team
* Contact us at team@anope.org
*
* Please read COPYING and README for further details.
*/
#include "modules.h"
#include "language.h"
Module::Module(const Anope::string &mname, const Anope::string &creator)
{
this->name = mname; /* Our name */
this->type = THIRD;
this->handle = NULL;
this->permanent = false;
for (int i = 0; i < NUM_LANGS; ++i)
this->lang[i].argc = 0;
if (FindModule(this->name))
throw CoreException("Module already exists!");
this->created = time(NULL);
this->SetVersion(Anope::Version());
Modules.push_back(this);
}
Module::~Module()
{
int i = 0;
for (i = 0; i < NUM_LANGS; ++i)
this->DeleteLanguage(i);
/* Detach all event hooks for this module */
ModuleManager::DetachAll(this);
/* Clear any active callbacks this module has */
ModuleManager::ClearCallBacks(this);
std::list<Module *>::iterator it = std::find(Modules.begin(), Modules.end(), this);
if (it != Modules.end())
Modules.erase(it);
}
void Module::SetType(MODType ntype)
{
this->type = ntype;
}
void Module::SetPermanent(bool state)
{
this->permanent = state;
}
bool Module::GetPermanent() const
{
return this->permanent;
}
void Module::SetVersion(const Anope::string &nversion)
{
this->version = nversion;
}
void Module::SetAuthor(const Anope::string &nauthor)
{
this->author = nauthor;
}
Version::Version(unsigned vMajor, unsigned vMinor, unsigned vBuild) : Major(vMajor), Minor(vMinor), Build(vBuild)
{
}
Version::~Version()
{
}
unsigned Version::GetMajor() const
{
return this->Major;
}
unsigned Version::GetMinor() const
{
return this->Minor;
}
unsigned Version::GetBuild() const
{
return this->Build;
}
|