changeset 6495:fb7902f66c36

mod_muc_auto_role: Skip processing for users already affiliated with the MUC
author Matthew Wild <mwild1@gmail.com>
date Wed, 25 Mar 2026 09:30:58 +0000
parents 88a8780c949f
children 5a01db53d680
files mod_muc_auto_role/mod_muc_auto_role.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_auto_role/mod_muc_auto_role.lua	Tue Mar 24 21:08:47 2026 +0000
+++ b/mod_muc_auto_role/mod_muc_auto_role.lua	Wed Mar 25 09:30:58 2026 +0000
@@ -17,6 +17,11 @@
 module:hook("muc-occupant-pre-join", function (event)
 	local stanza = event.stanza;
 
+	if event.room:get_affiliation(event.occupant.bare_jid) then
+		-- Skip for already-affiliated users
+		return;
+	end
+
 	local from_host = jid.host(stanza.attr.from);
 
 	if untrusted_servers:contains(from_host) then