# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1392923775 -3600
# Node ID a48cf3ccdf9ce2b7ea00cf3d9359bfafb959d5e6
# Parent  27b2a357c73c3ffde87b917814bdb14c4eec5db2
mod_mam_muc: Use public API of rooms for authorization check

diff -r 27b2a357c73c -r a48cf3ccdf9c mod_mam_muc/mod_mam_muc.lua
--- a/mod_mam_muc/mod_mam_muc.lua	Wed Feb 19 18:03:39 2014 +0700
+++ b/mod_mam_muc/mod_mam_muc.lua	Thu Feb 20 20:16:15 2014 +0100
@@ -94,8 +94,9 @@
 	local from = jid_bare(stanza.attr.from);
 
 	-- Banned or not a member of a members-only room?
-	if room_obj._affiliations[from] == "outcast"
-		or room_obj._data.members_only and not room_obj._affiliations[from] then
+	local from_affiliation = room_obj:get_affiliation(from);
+	if from_affiliation == "outcast" -- banned
+		or room_obj:get_members_only() and not from_affiliation then -- members-only, not a member
 		return origin.send(st.error_reply(stanza, "auth", "forbidden"))
 	end