X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodulemanager.cpp;h=8cb7a040175bdef246bcfe57a94e693e0de44ab1;hb=9ad873886e518bf3621a88e8c48607ab79020c0a;hp=eb40c59718dffa703cf0c3b089dea35fe3d73504;hpb=b2ac8cc0a6405946a388b80df3be21bc276a61f3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index eb40c5971..8cb7a0401 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -21,10 +21,6 @@ #include "exitcodes.h" #include -#ifndef _WIN32 -#include -#endif - bool ModuleManager::Load(const std::string& modname, bool defer) { /* Don't allow people to specify paths for modules, it doesn't work as expected */ @@ -66,7 +62,6 @@ bool ModuleManager::Load(const std::string& modname, bool defer) { newmod->ModuleSourceFile = filename; newmod->ModuleDLLManager = newhandle; - newmod->dying = false; Modules[filename] = newmod; std::string version = newhandle->GetVersion(); if (version.empty()) @@ -127,31 +122,29 @@ bool ModuleManager::Load(const std::string& modname, bool defer) /* We must load the modules AFTER initializing the socket engine, now */ void ModuleManager::LoadCoreModules(std::map& servicemap) { - std::cout << std::endl << "Loading core commands"; - fflush(stdout); + std::cout << "Loading core modules " << std::flush; - DIR* library = opendir(ServerInstance->Config->Paths.Module.c_str()); - if (library) + std::vector files; + if (!FileSystem::GetFileList(ServerInstance->Config->Paths.Module, files, "core_*.so")) { - dirent* entry = NULL; - while (0 != (entry = readdir(library))) - { - if (InspIRCd::Match(entry->d_name, "core_*.so", ascii_case_insensitive_map)) - { - std::cout << "."; - fflush(stdout); + std::cout << "failed!" << std::endl; + ServerInstance->Exit(EXIT_STATUS_MODULE); + } - this->NewServices = &servicemap[entry->d_name]; + for (std::vector::const_iterator iter = files.begin(); iter != files.end(); ++iter) + { + std::cout << "." << std::flush; - if (!Load(entry->d_name, true)) - { - ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError()); - std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; - ServerInstance->Exit(EXIT_STATUS_MODULE); - } - } + const std::string& name = *iter; + this->NewServices = &servicemap[name]; + + if (!Load(name, true)) + { + ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError()); + std::cout << std::endl << "[" << con_red << "*" << con_reset << "] " << this->LastError() << std::endl << std::endl; + ServerInstance->Exit(EXIT_STATUS_MODULE); } - closedir(library); - std::cout << std::endl; } + + std::cout << std::endl; }