Comparison

mod_mam_muc/mod_mam_muc.lua @ 2426:deedb77c4f96

mod_mam_muc: Rename room and room JID variables for consistency
author Kim Alvefur <zash@zash.se>
date Thu, 22 Dec 2016 13:40:24 +0100
parent 2414:97b4229982f5
child 2427:e5795f5f7a7b
comparison
equal deleted inserted replaced
2425:26c68a5f432f 2426:deedb77c4f96
153 end); 153 end);
154 154
155 -- Handle archive queries 155 -- Handle archive queries
156 module:hook("iq-set/bare/"..xmlns_mam..":query", function(event) 156 module:hook("iq-set/bare/"..xmlns_mam..":query", function(event)
157 local origin, stanza = event.origin, event.stanza; 157 local origin, stanza = event.origin, event.stanza;
158 local room = stanza.attr.to; 158 local room_jid = stanza.attr.to;
159 local room_node = jid_split(room); 159 local room_node = jid_split(room_jid);
160 local orig_from = stanza.attr.from; 160 local orig_from = stanza.attr.from;
161 local query = stanza.tags[1]; 161 local query = stanza.tags[1];
162 162
163 local room_obj = get_room_from_jid(room); 163 local room = get_room_from_jid(room_jid);
164 if not room_obj then 164 if not room then
165 origin.send(st.error_reply(stanza, "cancel", "item-not-found")) 165 origin.send(st.error_reply(stanza, "cancel", "item-not-found"))
166 return true; 166 return true;
167 end 167 end
168 local from = jid_bare(orig_from); 168 local from = jid_bare(orig_from);
169 169
170 -- Banned or not a member of a members-only room? 170 -- Banned or not a member of a members-only room?
171 local from_affiliation = room_obj:get_affiliation(from); 171 local from_affiliation = room:get_affiliation(from);
172 if from_affiliation == "outcast" -- banned 172 if from_affiliation == "outcast" -- banned
173 or room_obj:get_members_only() and not from_affiliation then -- members-only, not a member 173 or room:get_members_only() and not from_affiliation then -- members-only, not a member
174 origin.send(st.error_reply(stanza, "auth", "forbidden")) 174 origin.send(st.error_reply(stanza, "auth", "forbidden"))
175 return true; 175 return true;
176 end 176 end
177 177
178 local qid = query.attr.queryid; 178 local qid = query.attr.queryid;