Comparison

mod_groups_internal/mod_groups_internal.lua @ 4707:27f7ed9f50cd

mod_groups_internal: Remove deleted user from groups
author Kim Alvefur <zash@zash.se>
date Tue, 12 Oct 2021 13:57:24 +0200
parent 4706:428861d1d1e4
child 5708:9edc698848e9
comparison
equal deleted inserted replaced
4706:428861d1d1e4 4707:27f7ed9f50cd
303 module:log("debug", "found MUC host at %s", muc_host_name); 303 module:log("debug", "found MUC host at %s", muc_host_name);
304 muc_host = target_module; 304 muc_host = target_module;
305 end 305 end
306 end 306 end
307 307
308 module:hook_global("user-deleted", function(event)
309 if event.host ~= module.host then return end
310 local username = event.username;
311 for group_id in user_groups(username) do
312 remove_member(group_id, username);
313 end
314 end);
315
308 if prosody.start_time then -- server already started 316 if prosody.start_time then -- server already started
309 setup(); 317 setup();
310 else 318 else
311 module:hook_global("server-started", setup); 319 module:hook_global("server-started", setup);
312 end 320 end