aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2023-11-30 10:09:47 +0000
committerMatthew Wild <mwild1@gmail.com>2023-11-30 10:09:47 +0000
commit8a38b5d0da79c6177ba4c2523e72505b3937df7c (patch)
tree61c62cf5cfceddf938ab2afd0e2e601e51ec7568
parentf82d804e1d0f87de825262b4f0dbe206218da930 (diff)
downloadprosody-8a38b5d0da79c6177ba4c2523e72505b3937df7c.tar.gz
prosody-8a38b5d0da79c6177ba4c2523e72505b3937df7c.zip
modulemanager: Allow modules to expose module.ready - to be called after init
This is a shortcut for module:on_ready() which exposes the functionality in an idiomatic way consistent with module.load, module.unload, etc. module.ready runs when the module is loaded and the server has finished starting up.
-rw-r--r--core/modulemanager.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 00ceedbc..873e08e5 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -293,6 +293,10 @@ local function do_load_module(host, module_name, state)
ok, err = do_load_module(host, module_name);
end
end
+
+ if module_has_method(pluginenv, "ready") then
+ pluginenv.module:on_ready(pluginenv.module.ready);
+ end
end
if not ok then
modulemap[api_instance.host][module_name] = nil;