diff mod_muc_limits/mod_muc_limits.lua @ 3418:9be9dd434813

mod_muc_limits: Simplify bypass for affiliated users Fixes affiliation check for service admins which are always owners but not listed in `room._affiliations`
author Kim Alvefur <zash@zash.se>
date Sun, 23 Dec 2018 22:52:23 +0100
parents 1534d0715d35
children 5e91a34b1e71
line wrap: on
line diff
--- a/mod_muc_limits/mod_muc_limits.lua	Sun Dec 23 21:46:06 2018 +0100
+++ b/mod_muc_limits/mod_muc_limits.lua	Sun Dec 23 22:52:23 2018 +0100
@@ -31,8 +31,7 @@
 	local room = event.room or rooms[dest_room.."@"..dest_host];
 	if not room then return; end
 	local from_jid = stanza.attr.from;
-	local occupant = room._occupants[room._jid_nick[from_jid]];
-	if (occupant and occupant.affiliation) or (not(occupant) and room._affiliations[jid_bare(from_jid)]) then
+	if room:get_affiliation(jid_bare(from_jid)) then
 		module:log("debug", "Skipping stanza from affiliated user...");
 		return;
 	elseif dest_nick and max_nick_length and stanza.name == "presence" and not room._occupants[stanza.attr.to] and #dest_nick > max_nick_length then