diff options
-rw-r--r-- | src/coremods/core_info/cmd_modules.cpp | 15 | ||||
-rw-r--r-- | src/dynamic.cpp | 2 | ||||
-rw-r--r-- | src/modmanager_dynamic.cpp | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/coremods/core_info/cmd_modules.cpp b/src/coremods/core_info/cmd_modules.cpp index ef1ee7dbe..04f470bcd 100644 --- a/src/coremods/core_info/cmd_modules.cpp +++ b/src/coremods/core_info/cmd_modules.cpp @@ -22,6 +22,13 @@ #include "inspircd.h" #include "core_info.h" +enum +{ + // From ircd-ratbox with an InspIRCd-specific format. + RPL_MODLIST = 702, + RPL_ENDOFMODLIST = 703 +}; + CommandModules::CommandModules(Module* parent) : ServerTargetCommand(parent, "MODULES") { @@ -65,18 +72,18 @@ CmdResult CommandModules::Handle (const std::vector<std::string>& parameters, Us flags[pos] = '-'; #ifdef INSPIRCD_STATIC - user->WriteRemoteNumeric(702, InspIRCd::Format("%s %s :%s", m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str())); + user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, INSPIRCD_VERSION, flags, V.description); #else std::string srcrev = m->ModuleDLLManager->GetVersion(); - user->WriteRemoteNumeric(702, InspIRCd::Format("%s %s :%s - %s", m->ModuleSourceFile.c_str(), flags.c_str(), V.description.c_str(), srcrev.c_str())); + user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, srcrev.empty() ? "*" : srcrev, flags, V.description); #endif } else { - user->WriteRemoteNumeric(702, InspIRCd::Format("%s %s", m->ModuleSourceFile.c_str(), V.description.c_str())); + user->WriteRemoteNumeric(RPL_MODLIST, m->ModuleSourceFile, '*', '*', V.description); } } - user->WriteRemoteNumeric(703, "End of MODULES list"); + user->WriteRemoteNumeric(RPL_ENDOFMODLIST, "End of MODULES list"); return CMD_SUCCESS; } diff --git a/src/dynamic.cpp b/src/dynamic.cpp index 9984f4dbe..340f40e19 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -91,7 +91,7 @@ std::string DLLManager::GetVersion() const char* srcver = (char*)dlsym(h, "inspircd_src_version"); if (srcver) return srcver; - return "Unversioned module"; + return ""; } #ifdef _WIN32 diff --git a/src/modmanager_dynamic.cpp b/src/modmanager_dynamic.cpp index 9e940cc32..644d2140f 100644 --- a/src/modmanager_dynamic.cpp +++ b/src/modmanager_dynamic.cpp @@ -71,6 +71,8 @@ bool ModuleManager::Load(const std::string& modname, bool defer) newmod->dying = false; Modules[filename] = newmod; std::string version = newhandle->GetVersion(); + if (version.empty()) + version.assign("unknown"); if (defer) { ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "New module introduced: %s (Module version %s)", |