Comparison

plugins/muc/muc.lib.lua @ 6184:2bfc4b12ec8f

plugins/muc/muc.lib: Allow `:send_occupant_list` to have no filter
author daurnimator <quae@daurnimator.com>
date Fri, 28 Mar 2014 13:14:33 -0400
parent 6183:a8e777a19816
child 6185:d4a8840e72f9
comparison
equal deleted inserted replaced
6183:a8e777a19816 6184:2bfc4b12ec8f
274 274
275 function room_mt:send_occupant_list(to, filter) 275 function room_mt:send_occupant_list(to, filter)
276 local to_occupant = self:get_occupant_by_real_jid(to); 276 local to_occupant = self:get_occupant_by_real_jid(to);
277 local has_anonymous = self:get_whois() ~= "anyone" 277 local has_anonymous = self:get_whois() ~= "anyone"
278 for occupant_jid, occupant in self:each_occupant() do 278 for occupant_jid, occupant in self:each_occupant() do
279 if filter and filter(occupant_jid, occupant) then 279 if filter == nil or filter(occupant_jid, occupant) then
280 local x = st.stanza("x", {xmlns='http://jabber.org/protocol/muc#user'}); 280 local x = st.stanza("x", {xmlns='http://jabber.org/protocol/muc#user'});
281 local is_anonymous = has_anonymous and occupant.role ~= "moderator" and to_occupant.bare_jid ~= occupant.bare_jid; 281 local is_anonymous = has_anonymous and occupant.role ~= "moderator" and to_occupant.bare_jid ~= occupant.bare_jid;
282 self:build_item_list(occupant, x, is_anonymous); 282 self:build_item_list(occupant, x, is_anonymous);
283 local pres = st.clone(occupant:get_presence()); 283 local pres = st.clone(occupant:get_presence());
284 pres.attr.to = to; 284 pres.attr.to = to;