aboutsummaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-07-22 16:23:41 +0100
committerGravatar Sadie Powell2024-07-22 16:49:41 +0100
commit4e947b8733980f9d40f781f883b85e6f65bd953f (patch)
tree0c8aa2d2d5e28517c8bf8f907be1bc94b71e06e6 /src/modules.cpp
parentDisable text websockets when the server has an incompatible charset. (diff)
Allow contrib modules to specify their own module version.
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index a69b65418..b7cd29c84 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -46,8 +46,14 @@ void dynamic_reference_base::reset_all()
}
Module::Module(int mprops, const std::string& mdesc)
+ : Module(mprops, "", mdesc)
+{
+}
+
+Module::Module(int mprops, const std::string& mversion, const std::string& mdesc)
: description(mdesc)
, properties(mprops)
+ , version(mversion)
{
}
@@ -83,6 +89,15 @@ std::string Module::GetPropertyString() const
return propstr;
}
+std::string Module::GetVersion() const
+{
+ if (!version.empty())
+ return version;
+
+ const auto* dll_version = ModuleDLL->GetVersion();
+ return dll_version ? dll_version : "unknown";
+}
+
void Module::DetachEvent(Implementation i)
{
ServerInstance->Modules.Detach(i, this);