# HG changeset patch # User Waqas Hussain # Date 1276972705 -18000 # Node ID eef4f31f2d7be6f67d0d266a1c2727a984ea1f73 # Parent 8b0a4a7d2c6ec0bcd9f3ba82038b5ee5d710419a MUC: Updated room:set_role() to use room:can_set_role(). diff -r 8b0a4a7d2c6e -r eef4f31f2d7b plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Sat Jun 19 23:35:53 2010 +0500 +++ b/plugins/muc/muc.lib.lua Sat Jun 19 23:38:25 2010 +0500 @@ -901,10 +901,9 @@ function room_mt:set_role(actor, occupant_jid, role, callback, reason) if role == "none" then role = nil; end if role and role ~= "moderator" and role ~= "participant" and role ~= "visitor" then return nil, "modify", "not-acceptable"; end - if self:get_affiliation(actor) ~= "owner" then return nil, "cancel", "not-allowed"; end + local allowed, err_type, err_condition = self:can_set_role(actor, occupant_jid, role); + if not allowed then return allowed, err_type, err_condition; end local occupant = self._occupants[occupant_jid]; - if not occupant then return nil, "modify", "not-acceptable"; end - if occupant.affiliation == "owner" or occupant.affiliation == "admin" then return nil, "cancel", "not-allowed"; end local p = st.presence({from = occupant_jid}) :tag("x", {xmlns = "http://jabber.org/protocol/muc#user"}) :tag("item", {affiliation=occupant.affiliation or "none", nick=select(3, jid_split(occupant_jid)), role=role or "none"})