Software /
code /
prosody-modules
Diff
mod_groups_internal/mod_groups_internal.lua @ 4417:7e379ccb8ed6
mod_groups_internal: make robust against module reloads
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Sun, 31 Jan 2021 12:14:21 +0100 |
parent | 4415:c7424b96c75e |
child | 4418:8c31d4b872c3 |
line wrap: on
line diff
--- a/mod_groups_internal/mod_groups_internal.lua Sat Jan 30 16:31:15 2021 +0100 +++ b/mod_groups_internal/mod_groups_internal.lua Sun Jan 31 12:14:21 2021 +0100 @@ -244,7 +244,7 @@ return group_info_store:users(); end -local function handle_server_started() +local function setup() if not muc_host_name then module:log("info", "MUC management disabled (groups_muc_host set to nil)"); return; @@ -259,4 +259,8 @@ end end -module:hook_global("server-started", handle_server_started); +if prosody.start_time then -- server already started + setup(); +else + module:hook_global("server-started", setup); +end