diff options
Diffstat (limited to 'src/module.cpp')
-rw-r--r-- | src/module.cpp | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/src/module.cpp b/src/module.cpp index 3e377efec..7269800d5 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -1,21 +1,34 @@ -/* Modular support +/* + * Anope IRC Services * - * (C) 2003-2016 Anope Team - * Contact us at team@anope.org + * Copyright (C) 2008-2016 Anope Team <team@anope.org> * - * Please read COPYING and README for further details. + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ #include "services.h" #include "modules.h" #include "language.h" -#include "account.h" #ifdef GETTEXT_FOUND # include <libintl.h> #endif -Module::Module(const Anope::string &modname, const Anope::string &, ModType modtype) : name(modname), type(modtype) +Module::Module(const Anope::string &modname, const Anope::string &, ModType modtype) + : name(modname) + , type(modtype) + , logger(this) { this->handle = NULL; this->permanent = false; @@ -23,7 +36,9 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt this->SetVersion(Anope::Version()); if (type & VENDOR) + { this->SetAuthor("Anope"); + } else { /* Not vendor implies third */ @@ -33,14 +48,14 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt if (ModuleManager::FindModule(this->name)) throw CoreException("Module already exists!"); - + if (Anope::NoThird && type & THIRD) throw ModuleException("Third party modules may not be loaded"); ModuleManager::Modules.push_back(this); #if GETTEXT_FOUND - for (unsigned i = 0; i < Language::Languages.size(); ++i) + for (unsigned int i = 0; i < Language::Languages.size(); ++i) { /* Remove .UTF-8 or any other suffix */ Anope::string lang; @@ -49,10 +64,12 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt if (Anope::IsFile(Anope::LocaleDir + "/" + lang + "/LC_MESSAGES/" + modname + ".mo")) { if (!bindtextdomain(this->name.c_str(), Anope::LocaleDir.c_str())) - Log() << "Error calling bindtextdomain, " << Anope::LastError(); + { + Anope::Logger.Log("Error calling bindtextdomain, {0}", Anope::LastError()); + } else { - Log() << "Found language file " << lang << " for " << modname; + Anope::Logger.Log("Found language file {0} for {1}", lang, modname); Language::Domains.push_back(modname); } break; @@ -63,11 +80,6 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt Module::~Module() { - UnsetExtensibles(); - - /* Detach all event hooks for this module */ - ModuleManager::DetachAll(this); - IdentifyRequest::ModuleUnload(this); /* Clear any active timers this module has */ TimerManager::DeleteTimersFor(this); @@ -82,6 +94,11 @@ Module::~Module() #endif } +const Anope::string &Module::GetName() const +{ + return this->name; +} + void Module::SetPermanent(bool state) { this->permanent = state; @@ -102,10 +119,6 @@ void Module::SetAuthor(const Anope::string &nauthor) this->author = nauthor; } -void Module::Prioritize() -{ -} - ModuleVersion::ModuleVersion(const ModuleVersionC &ver) { version_major = ver.version_major; |