mod_muc_moderation/mod_muc_moderation.lua
changeset 4753 3a7953a5ee5b
parent 4181 a38e6a8a781a
child 4754 98429b646bd4
equal deleted inserted replaced
4752:a6b94f4fb065 4753:3a7953a5ee5b
    53 
    53 
    54 	-- Permissions
    54 	-- Permissions
    55 	local actor = stanza.attr.from;
    55 	local actor = stanza.attr.from;
    56 	local actor_nick = room:get_occupant_jid(actor);
    56 	local actor_nick = room:get_occupant_jid(actor);
    57 	local affiliation = room:get_affiliation(actor);
    57 	local affiliation = room:get_affiliation(actor);
       
    58 	-- Retrieve their current role, iff they are in the room, otherwise what they
       
    59 	-- would have based on affiliation.
    58 	local role = room:get_role(actor_nick) or room:get_default_role(affiliation);
    60 	local role = room:get_role(actor_nick) or room:get_default_role(affiliation);
    59 	if valid_roles[role or "none"] < valid_roles.moderator then
    61 	if valid_roles[role or "none"] < valid_roles.moderator then
    60 		origin.send(st.error_reply(stanza, "auth", "forbidden", "You need a role of at least 'moderator'"));
    62 		origin.send(st.error_reply(stanza, "auth", "forbidden", "You need a role of at least 'moderator'"));
    61 		return true;
    63 		return true;
    62 	end
    64 	end