# HG changeset patch # User daurnimator # Date 1396563016 14400 # Node ID a90159cfa53077b33d3df9e6be6d6c032a295d66 # Parent bf11910bad5a369ee8676a167ca37bc058cf6e3d plugins/muc/muc.lib: Fix getting a list of occupants by role (it was sending presences instead of items inside an iq) diff -r bf11910bad5a -r a90159cfa530 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Thu Apr 03 17:09:04 2014 -0400 +++ b/plugins/muc/muc.lib.lua Thu Apr 03 18:10:16 2014 -0400 @@ -113,7 +113,6 @@ stanza.attr.to = to; end --- Adds an item to an "x" element. -- actor is the attribute table local function add_item(x, affiliation, role, jid, nick, actor, reason) x:tag("item", {affiliation = affiliation; role = role; jid = jid; nick = nick;}) @@ -874,9 +873,17 @@ end elseif _rol and not _aff then local role = self:get_role(self:get_occupant_jid(actor)) or self:get_default_role(affiliation); - if role == "moderator" then + if valid_roles[role or "none"] >= valid_roles.moderator then if _rol == "none" then _rol = nil; end - self:send_occupant_list(actor, function(occupant_jid, occupant) return occupant.role == _rol end); + local reply = st.reply(stanza):query("http://jabber.org/protocol/muc#admin"); + -- TODO: whois check here? (though fully anonymous rooms are not supported) + for occupant_jid, occupant in self:each_occupant() do + if occupant.role == _rol then + local nick = select(3,jid_split(occupant_jid)); + self:build_item_list(occupant, reply, false, nick); + end + end + origin.send(reply:up()); return true; else origin.send(st.error_reply(stanza, "auth", "forbidden"));