summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-09-05 18:33:50 +0100
committerPeter Powell <petpow@saberuk.com>2017-09-06 09:26:00 +0100
commitf1bfa8242c0a5b76bcff36c70103c2aae7cbdf5f (patch)
treebfb0c3393f9d7bf7be25670c51fc97d7e869bc61 /src
parentc0ca5c8d41a71eae4ec132e492b546fa03510871 (diff)
Improve the /MODULES output.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_info/cmd_modules.cpp15
-rw-r--r--src/dynamic.cpp2
-rw-r--r--src/modmanager_dynamic.cpp2
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)",