diff options
author | Peter Powell <petpow@saberuk.com> | 2018-07-31 00:49:27 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-07-31 03:20:18 +0100 |
commit | d9a52277df06d656564b28e456adabbee52e8c10 (patch) | |
tree | b4ffb2c8dbb3ecef708220826548850c68434f3b /src/modmanager_static.cpp | |
parent | abbf70b2a35edaf17631e43027828011296924ad (diff) |
Remove support for static modules.
This has been frequently broken in the past and as far as I know is
used by literally nobody.
Also, even if all modules are compiled into the core any libraries
linked against are and have always been linked dynamically making
this unusable on platforms without dynamic libraries.
Diffstat (limited to 'src/modmanager_static.cpp')
-rw-r--r-- | src/modmanager_static.cpp | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp deleted file mode 100644 index 4de111b63..000000000 --- a/src/modmanager_static.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * InspIRCd -- Internet Relay Chat Daemon - * - * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org> - * - * This file is part of InspIRCd. InspIRCd 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 <http://www.gnu.org/licenses/>. - */ - - -#define MODNAME "core_all" - -#include "inspircd.h" -#include "exitcodes.h" -#include <iostream> - -#ifdef INSPIRCD_STATIC - -typedef std::map<std::string, AllModuleList*> modmap; -static std::vector<AllCommandList::fn>* cmdlist = NULL; -static modmap* modlist = NULL; - -AllCommandList::AllCommandList(fn cmd) -{ - if (!cmdlist) - cmdlist = new std::vector<AllCommandList::fn>(); - cmdlist->push_back(cmd); -} - -AllModuleList::AllModuleList(AllModuleList::fn mod, const std::string& Name) : init(mod), name(Name) -{ - if (!modlist) - modlist = new modmap(); - modlist->insert(std::make_pair(Name, this)); -} - -class AllModule : public Module -{ - std::vector<Command*> cmds; - public: - AllModule() - { - if (!cmdlist) - return; - try - { - cmds.reserve(cmdlist->size()); - for(std::vector<AllCommandList::fn>::iterator i = cmdlist->begin(); i != cmdlist->end(); ++i) - { - Command* c = (*i)(this); - cmds.push_back(c); - } - } - catch (...) - { - this->AllModule::~AllModule(); - throw; - } - } - - ~AllModule() - { - stdalgo::delete_all(cmds); - } - - Version GetVersion() CXX11_OVERRIDE - { - return Version("All commands", VF_VENDOR|VF_CORE); - } -}; - -MODULE_INIT(AllModule) - -bool ModuleManager::Load(const std::string& inputname, bool defer) -{ - const std::string name = ExpandModName(inputname); - modmap::iterator it = modlist->find(name); - if (it == modlist->end()) - return false; - Module* mod = NULL; - - ServiceList newservices; - if (!defer) - this->NewServices = &newservices; - - try - { - mod = (*it->second->init)(); - mod->ModuleSourceFile = name; - mod->ModuleDLLManager = NULL; - mod->dying = false; - Modules[name] = mod; - this->NewServices = NULL; - if (defer) - { - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "New module introduced: %s", name.c_str()); - return true; - } - else - { - ConfigStatus confstatus; - - AttachAll(mod); - AddServices(newservices); - mod->init(); - mod->ReadConfig(confstatus); - } - } - catch (CoreException& modexcept) - { - this->NewServices = NULL; - - if (mod) - DoSafeUnload(mod); - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason()); - return false; - } - - FOREACH_MOD(OnLoadModule, (mod)); - PrioritizeHooks(); - ServerInstance->ISupport.Build(); - return true; -} - -void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicemap) -{ - for (modmap::const_iterator i = modlist->begin(); i != modlist->end(); ++i) - { - const std::string modname = i->first; - if (InspIRCd::Match(modname, "core_*.so", ascii_case_insensitive_map)) - { - this->NewServices = &servicemap[modname]; - Load(modname, true); - } - } - this->NewServices = NULL; -} - -#endif |