From 4e947b8733980f9d40f781f883b85e6f65bd953f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Mon, 22 Jul 2024 16:23:41 +0100 Subject: Allow contrib modules to specify their own module version. --- src/modules.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/modules.cpp') 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); -- cgit v1.3.1-10-gc9f91