aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-06-19 23:38:25 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-06-19 23:38:25 +0500
commitf9086ab736629174376ecb5bf13843407e5530b0 (patch)
tree02710b96c9baa7a96b9314e68ccba83baeb703e0 /plugins
parent178b5282e806bae8b13f07c3822caeebc44c1787 (diff)
downloadprosody-f9086ab736629174376ecb5bf13843407e5530b0.tar.gz
prosody-f9086ab736629174376ecb5bf13843407e5530b0.zip
MUC: Updated room:set_role() to use room:can_set_role().
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 6800aca6..1bbd1474 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -901,10 +901,9 @@ end
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"})