aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-03-28 13:34:46 -0400
committerdaurnimator <quae@daurnimator.com>2014-03-28 13:34:46 -0400
commit97759d2f65c1578f8a0cb030fb4ea83ff8d45682 (patch)
treedab4f93dd11f59fa3275945bce6149faab237319 /plugins/muc
parentf9f2d557fa2db46dbdbc510c4a326be26b237e52 (diff)
downloadprosody-97759d2f65c1578f8a0cb030fb4ea83ff8d45682.tar.gz
prosody-97759d2f65c1578f8a0cb030fb4ea83ff8d45682.zip
plugins/muc/muc.lib: Fix anonymous check in `send_occupant_list`
Diffstat (limited to 'plugins/muc')
-rw-r--r--plugins/muc/muc.lib.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index b5b8bc97..02a2dc37 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -273,13 +273,21 @@ function room_mt:publicise_occupant_status(occupant, full_x, actor, reason)
end
function room_mt:send_occupant_list(to, filter)
- local to_occupant = self:get_occupant_by_real_jid(to);
- local has_anonymous = self:get_whois() ~= "anyone"
+ local to_bare = jid_bare(to);
+ local is_anonymous = true;
+ if self:get_whois() ~= "anyone" then
+ local affiliation = self:get_affiliation(to);
+ if affiliation ~= "admin" and affiliation ~= "owner" then
+ local occupant = self:get_occupant_by_real_jid(to);
+ if not occupant or occupant.role ~= "moderator" then
+ is_anonymous = false;
+ end
+ end
+ end
for occupant_jid, occupant in self:each_occupant() do
if filter == nil or filter(occupant_jid, occupant) then
local x = st.stanza("x", {xmlns='http://jabber.org/protocol/muc#user'});
- local is_anonymous = has_anonymous and occupant.role ~= "moderator" and to_occupant.bare_jid ~= occupant.bare_jid;
- self:build_item_list(occupant, x, is_anonymous);
+ self:build_item_list(occupant, x, is_anonymous and to_bare ~= occupant.bare_jid); -- can always see your own jids
local pres = st.clone(occupant:get_presence());
pres.attr.to = to;
pres:add_child(x);