Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 6124:203f2b4933b0
plugins/muc/muc.lib: Check role instead of current_nick
| author | daurnimator <quae@daurnimator.com> |
|---|---|
| date | Wed, 19 Mar 2014 17:30:21 -0400 |
| parents | 7f82bbd249fe |
| children | 4a35a0281d8a |
comparison
equal
deleted
inserted
replaced
| 6123:7f82bbd249fe | 6124:203f2b4933b0 |
|---|---|
| 985 | 985 |
| 986 function room_mt:handle_mediated_invite(origin, stanza) | 986 function room_mt:handle_mediated_invite(origin, stanza) |
| 987 local payload = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite") | 987 local payload = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite") |
| 988 local _from, _to = stanza.attr.from, stanza.attr.to; | 988 local _from, _to = stanza.attr.from, stanza.attr.to; |
| 989 local current_nick = self:get_occupant_jid(_from) | 989 local current_nick = self:get_occupant_jid(_from) |
| 990 if not current_nick then -- Should be in room to send invite TODO: allow admins to send at any time | 990 -- Need visitor role or higher to invite |
| 991 if not self._occupants[current_nick].role then | |
| 991 origin.send(st.error_reply(stanza, "auth", "forbidden")); | 992 origin.send(st.error_reply(stanza, "auth", "forbidden")); |
| 992 return true; | 993 return true; |
| 993 end | 994 end |
| 994 local _invitee = jid_prep(payload.attr.to); | 995 local _invitee = jid_prep(payload.attr.to); |
| 995 if _invitee then | 996 if _invitee then |
