changeset 1312:a48cf3ccdf9c

mod_mam_muc: Use public API of rooms for authorization check
author Kim Alvefur <zash@zash.se>
date Thu, 20 Feb 2014 20:16:15 +0100 (2014-02-20)
parents 27b2a357c73c
children 440d7276ca62
files mod_mam_muc/mod_mam_muc.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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