Diff

mod_groups_internal/mod_groups_internal.lua @ 4424:679be18e6a5e

mod_groups_internal: emit events for group membership changes
author Jonas Schäfer <jonas@wielicki.name>
date Wed, 03 Feb 2021 18:02:39 +0100
parent 4423:ca821df93cb9
child 4430:71c495fa03f3
line wrap: on
line diff
--- a/mod_groups_internal/mod_groups_internal.lua	Tue Feb 02 22:28:09 2021 +0100
+++ b/mod_groups_internal/mod_groups_internal.lua	Wed Feb 03 18:02:39 2021 +0100
@@ -216,6 +216,15 @@
 			module:log("warn", "failed to update affiliation for %s in %s", username, group_info.muc_jid);
 		end
 	end
+	module:fire_event(
+		"group-user-added",
+		{
+			id = group_id,
+			user = username,
+			host = host,
+			group_info = group_info,
+		}
+	)
 	if not delay_update then
 		do_all_group_subscriptions_by_group(group_id);
 	end
@@ -239,6 +248,15 @@
 			module:log("warn", "failed to update affiliation for %s in %s", username, group_info.muc_jid);
 		end
 	end
+	module:fire_event(
+		"group-user-removed",
+		{
+			id = group_id,
+			user = username,
+			host = host,
+			group_info = group_info,
+		}
+	)
 	return true;
 end