plugins/muc/muc.lib.lua

changeset 2979
b1726c2a2afc
parent 2923
b7049746bd29
child 2984
3094166cfdd5
equal deleted inserted replaced
2967:c39ad633b26d 2979:b1726c2a2afc
671 return session and session.role or nil; 671 return session and session.role or nil;
672 end 672 end
673 function room_mt:set_role(actor, occupant_jid, role, callback, reason) 673 function room_mt:set_role(actor, occupant_jid, role, callback, reason)
674 if role == "none" then role = nil; end 674 if role == "none" then role = nil; end
675 if role and role ~= "moderator" and role ~= "participant" and role ~= "visitor" then return nil, "modify", "not-acceptable"; end 675 if role and role ~= "moderator" and role ~= "participant" and role ~= "visitor" then return nil, "modify", "not-acceptable"; end
676 if self:get_affiliation(actor) ~= "owner" then return nil, "cancel", "not-allowed"; end 676 if self:get_role(self._jid_nick[actor]) ~= "moderator" then return nil, "cancel", "not-allowed"; end
677 local occupant = self._occupants[occupant_jid]; 677 local occupant = self._occupants[occupant_jid];
678 if not occupant then return nil, "modify", "not-acceptable"; end 678 if not occupant then return nil, "modify", "not-acceptable"; end
679 if occupant.affiliation == "owner" or occupant.affiliation == "admin" then return nil, "cancel", "not-allowed"; end 679 if occupant.affiliation == "owner" or occupant.affiliation == "admin" then return nil, "cancel", "not-allowed"; end
680 local p = st.presence({from = occupant_jid}) 680 local p = st.presence({from = occupant_jid})
681 :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"}) 681 :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"})

mercurial