diff options
| author | 2024-07-22 16:23:41 +0100 | |
|---|---|---|
| committer | 2024-07-22 16:49:41 +0100 | |
| commit | 4e947b8733980f9d40f781f883b85e6f65bd953f (patch) | |
| tree | 0c8aa2d2d5e28517c8bf8f907be1bc94b71e06e6 /src/modules.cpp | |
| parent | Disable 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.cpp | 15 |
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); |
