comparison mod_groups_internal/mod_groups_internal.lua @ 4430:71c495fa03f3

mod_groups_internal: allow force-emitting group member addition events This is useful when a new plugin was loaded which handles that event to add some value. Then the command can be called (**not** from the plugin but from an upcoming admin shell module) to synchronise things.
author Jonas Schäfer <jonas@wielicki.name>
date Fri, 05 Feb 2021 15:45:28 +0100
parents 679be18e6a5e
children 428861d1d1e4
comparison
equal deleted inserted replaced
4429:157fa4e535b0 4430:71c495fa03f3
262 262
263 function sync(group_id) 263 function sync(group_id)
264 do_all_group_subscriptions_by_group(group_id); 264 do_all_group_subscriptions_by_group(group_id);
265 end 265 end
266 266
267 function emit_member_events(group_id)
268 local group_info, err = get_info(group_id)
269 if group_info == nil then
270 return false, err
271 end
272
273 for username in pairs(get_members(group_id)) do
274 module:fire_event(
275 "group-user-added",
276 {
277 id = group_id,
278 user = username,
279 host = host,
280 group_info = group_info,
281 }
282 )
283 end
284
285 return true
286 end
287
267 -- Returns iterator over group ids 288 -- Returns iterator over group ids
268 function groups() 289 function groups()
269 return group_info_store:users(); 290 return group_info_store:users();
270 end 291 end
271 292