Software /
code /
prosody
Comparison
plugins/muc/muc.lib.lua @ 2979:b1726c2a2afc
MUC: Allow moderators which are not owners to change roles.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 14 Apr 2010 17:54:33 +0500 |
parent | 2923:b7049746bd29 |
child | 2984:3094166cfdd5 |
comparison
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"}) |