if (filename.find('/') != std::string::npos)
return false;
- char modfile[MAXBUF];
- snprintf(modfile,MAXBUF,"%s/%s",ServerInstance->Config->ModPath.c_str(),filename.c_str());
+ const std::string moduleFile = ServerInstance->Config->ModPath + "/" + filename;
- if (!ServerConfig::FileExists(modfile))
+ if (!ServerConfig::FileExists(moduleFile.c_str()))
{
LastModuleError = "Module file could not be found: " + filename;
ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, LastModuleError);
}
Module* newmod = NULL;
- DLLManager* newhandle = new DLLManager(modfile);
+ DLLManager* newhandle = new DLLManager(moduleFile.c_str());
try
{
std::string version = newhandle->GetVersion();
if (defer)
{
- ServerInstance->Logs->Log("MODULE", LOG_DEFAULT,"New module introduced: %s (Module version %s)",
+ ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)",
filename.c_str(), version.c_str());
}
else
newmod->init();
Version v = newmod->GetVersion();
- ServerInstance->Logs->Log("MODULE", LOG_DEFAULT,"New module introduced: %s (Module version %s)%s",
+ ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)%s",
filename.c_str(), version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]"));
}
}
if (defer)
return true;
- FOREACH_MOD(I_OnLoadModule,OnLoadModule(newmod));
+ FOREACH_MOD(OnLoadModule, (newmod));
/* We give every module a chance to re-prioritize when we introduce a new one,
* not just the one thats loading, as the new module could affect the preference
* of others