Changeset

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
parents 4416:dd3bfe8f182e
children 4418:8c31d4b872c3
files mod_groups_internal/mod_groups_internal.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
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