plugins/muc/muc.lib: Check role instead of current_nick
authordaurnimator <quae@daurnimator.com>
Wed, 19 Mar 2014 17:30:21 -0400
changeset 6124 203f2b4933b0
parent 6123 7f82bbd249fe
child 6125 4a35a0281d8a
plugins/muc/muc.lib: Check role instead of current_nick
plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Wed Mar 19 16:28:11 2014 -0400
+++ b/plugins/muc/muc.lib.lua	Wed Mar 19 17:30:21 2014 -0400
@@ -987,7 +987,8 @@
 	local payload = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite")
 	local _from, _to = stanza.attr.from, stanza.attr.to;
 	local current_nick = self:get_occupant_jid(_from)
-	if not current_nick then -- Should be in room to send invite TODO: allow admins to send at any time
+	-- Need visitor role or higher to invite
+	if not self._occupants[current_nick].role then
 		origin.send(st.error_reply(stanza, "auth", "forbidden"));
 		return true;
 	end