- int n_match = 0;
- DIR* library = opendir(Instance->Config->ModPath.c_str());
- if (library)
- {
- /* Try and locate and load all modules matching the pattern */
- dirent* entry = NULL;
- while (0 != (entry = readdir(library)))
- {
- if (InspIRCd::Match(entry->d_name, filename, ascii_case_insensitive_map))
- {
- if (!this->Load(entry->d_name))
- n_match++;
- }
- }
- closedir(library);
- }
- /* Loadmodule will now return false if any one of the modules failed
- * to load (but wont abort when it encounters a bad one) and when 1 or
- * more modules were actually loaded.
- */
- return (n_match > 0 ? false : true);
- }
-
- char modfile[MAXBUF];
- snprintf(modfile,MAXBUF,"%s/%s",Instance->Config->ModPath.c_str(),filename);
- std::string filename_str = filename;
-
- if (!ServerConfig::FileExists(modfile))
- {
- LastModuleError = "Module file could not be found: " + filename_str;
- Instance->Logs->Log("MODULE", DEFAULT, LastModuleError);
+ LastModuleError = "Module " + mod->ModuleSourceFile + " is not loaded, cannot unload it!";
+ ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError);