mirror of
https://github.com/anope/anope.git
synced 2026-06-25 15:46:37 +02:00
Pretty large coding style cleanup, in source doc
cleanup, and allow protocol mods to depend on each other
This commit is contained in:
+33
-21
@@ -4,13 +4,13 @@
|
||||
* Contact us at team@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "services.h"
|
||||
#include "modules.h"
|
||||
#include "extern.h"
|
||||
#include "dns.h"
|
||||
#include "language.h"
|
||||
|
||||
#ifdef GETTEXT_FOUND
|
||||
# include <libintl.h>
|
||||
@@ -26,19 +26,19 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
|
||||
if (ModuleManager::FindModule(this->name))
|
||||
throw CoreException("Module already exists!");
|
||||
|
||||
if (nothird && modtype == THIRD)
|
||||
if (Anope::NoThird && modtype == THIRD)
|
||||
throw ModuleException("Third party modules may not be loaded");
|
||||
|
||||
Modules.push_back(this);
|
||||
ModuleManager::Modules.push_back(this);
|
||||
|
||||
#if GETTEXT_FOUND
|
||||
for (unsigned i = 0; i < languages.size(); ++i)
|
||||
if (IsFile(locale_dir + "/" + languages[i] + "/LC_MESSAGES/" + modname + ".mo"))
|
||||
for (unsigned i = 0; i < Language::Languages.size(); ++i)
|
||||
if (Anope::IsFile(Anope::LocaleDir + "/" + Language::Languages[i] + "/LC_MESSAGES/" + modname + ".mo"))
|
||||
{
|
||||
if (!bindtextdomain(this->name.c_str(), locale_dir.c_str()))
|
||||
if (!bindtextdomain(this->name.c_str(), Anope::LocaleDir.c_str()))
|
||||
Log() << "Error calling bindtextdomain, " << Anope::LastError();
|
||||
else
|
||||
domains.push_back(modname);
|
||||
Language::Domains.push_back(modname);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -46,22 +46,22 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt
|
||||
|
||||
Module::~Module()
|
||||
{
|
||||
if (DNSEngine)
|
||||
DNSEngine->Cleanup(this);
|
||||
if (DNS::Engine)
|
||||
DNS::Engine->Cleanup(this);
|
||||
/* Detach all event hooks for this module */
|
||||
ModuleManager::DetachAll(this);
|
||||
/* Clear any active callbacks this module has */
|
||||
ModuleManager::ClearCallBacks(this);
|
||||
IdentifyRequest::ModuleUnload(this);
|
||||
|
||||
std::list<Module *>::iterator it = std::find(Modules.begin(), Modules.end(), this);
|
||||
if (it != Modules.end())
|
||||
Modules.erase(it);
|
||||
std::list<Module *>::iterator it = std::find(ModuleManager::Modules.begin(), ModuleManager::Modules.end(), this);
|
||||
if (it != ModuleManager::Modules.end())
|
||||
ModuleManager::Modules.erase(it);
|
||||
|
||||
#if GETTEXT_FOUND
|
||||
std::vector<Anope::string>::iterator dit = std::find(domains.begin(), domains.end(), this->name);
|
||||
if (dit != domains.end())
|
||||
domains.erase(dit);
|
||||
std::vector<Anope::string>::iterator dit = std::find(Language::Domains.begin(), Language::Domains.end(), this->name);
|
||||
if (dit != Language::Domains.end())
|
||||
Language::Domains.erase(dit);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -85,26 +85,38 @@ void Module::SetAuthor(const Anope::string &nauthor)
|
||||
this->author = nauthor;
|
||||
}
|
||||
|
||||
ModuleVersion::ModuleVersion(int vMajor, int vMinor, int vPatch) : Major(vMajor), Minor(vMinor), Patch(vPatch)
|
||||
IRCDProto *Module::GetIRCDProto()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ModuleVersion::~ModuleVersion()
|
||||
ModuleVersion::ModuleVersion(int maj, int min, int pa) : version_major(maj), version_minor(min), version_patch(pa)
|
||||
{
|
||||
}
|
||||
|
||||
int ModuleVersion::GetMajor() const
|
||||
{
|
||||
return this->Major;
|
||||
return this->version_major;
|
||||
}
|
||||
|
||||
int ModuleVersion::GetMinor() const
|
||||
{
|
||||
return this->Minor;
|
||||
return this->version_minor;
|
||||
}
|
||||
|
||||
int ModuleVersion::GetPatch() const
|
||||
{
|
||||
return this->Patch;
|
||||
return this->version_patch;
|
||||
}
|
||||
|
||||
CallBack::CallBack(Module *mod, long time_from_now, time_t now, bool repeating) : Timer(time_from_now, now, repeating), m(mod)
|
||||
{
|
||||
}
|
||||
|
||||
CallBack::~CallBack()
|
||||
{
|
||||
std::list<CallBack *>::iterator it = std::find(m->callbacks.begin(), m->callbacks.end(), this);
|
||||
if (it != m->callbacks.end())
|
||||
m->callbacks.erase(it);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user