comparison mod_mam_muc/mod_mam_muc.lua @ 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
parents 27b2a357c73c
children 440d7276ca62
comparison
equal deleted inserted replaced
1311:27b2a357c73c 1312:a48cf3ccdf9c
92 return origin.send(st.error_reply(stanza, "cancel", "item-not-found")) 92 return origin.send(st.error_reply(stanza, "cancel", "item-not-found"))
93 end 93 end
94 local from = jid_bare(stanza.attr.from); 94 local from = jid_bare(stanza.attr.from);
95 95
96 -- Banned or not a member of a members-only room? 96 -- Banned or not a member of a members-only room?
97 if room_obj._affiliations[from] == "outcast" 97 local from_affiliation = room_obj:get_affiliation(from);
98 or room_obj._data.members_only and not room_obj._affiliations[from] then 98 if from_affiliation == "outcast" -- banned
99 or room_obj:get_members_only() and not from_affiliation then -- members-only, not a member
99 return origin.send(st.error_reply(stanza, "auth", "forbidden")) 100 return origin.send(st.error_reply(stanza, "auth", "forbidden"))
100 end 101 end
101 102
102 local qid = query.attr.queryid; 103 local qid = query.attr.queryid;
103 104