const std::string moduleFile = ServerInstance->Config->Paths.PrependModule(filename);
- if (!ServerConfig::FileExists(moduleFile.c_str()))
+ if (!FileSystem::FileExists(moduleFile))
{
LastModuleError = "Module file could not be found: " + filename;
ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError);
Module* newmod = NULL;
DLLManager* newhandle = new DLLManager(moduleFile.c_str());
+ ServiceList newservices;
+ if (!defer)
+ this->NewServices = &newservices;
try
{
newmod = newhandle->CallInit();
+ this->NewServices = NULL;
if (newmod)
{
ConfigStatus confstatus;
AttachAll(newmod);
+ AddServices(newservices);
newmod->init();
newmod->ReadConfig(confstatus);
}
catch (CoreException& modexcept)
{
+ this->NewServices = NULL;
+
// failure in module constructor
if (newmod)
{
}
/* We must load the modules AFTER initializing the socket engine, now */
-void ModuleManager::LoadCoreModules()
+void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicemap)
{
std::cout << std::endl << "Loading core commands";
fflush(stdout);
std::cout << ".";
fflush(stdout);
+ this->NewServices = &servicemap[entry->d_name];
+
if (!Load(entry->d_name, true))
{
ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, this->LastError());