Mercurial > prosody-hg
comparison plugins/muc/muc.lib.lua @ 6127:a66ebc5d0ab5
plugins/muc/muc.lib: Allow users with affiliations to invite while not in room themselves
| author | daurnimator <quae@daurnimator.com> |
|---|---|
| date | Wed, 19 Mar 2014 17:50:00 -0400 |
| parents | 122e0f26e8f6 |
| children | 8a71a1c34202 |
comparison
equal
deleted
inserted
replaced
| 6126:122e0f26e8f6 | 6127:a66ebc5d0ab5 |
|---|---|
| 984 function room_mt:handle_mediated_invite(origin, stanza) | 984 function room_mt:handle_mediated_invite(origin, stanza) |
| 985 local payload = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite") | 985 local payload = stanza:get_child("x", "http://jabber.org/protocol/muc#user"):get_child("invite") |
| 986 local _from, _to = stanza.attr.from, stanza.attr.to; | 986 local _from, _to = stanza.attr.from, stanza.attr.to; |
| 987 local current_nick = self:get_occupant_jid(_from) | 987 local current_nick = self:get_occupant_jid(_from) |
| 988 -- Need visitor role or higher to invite | 988 -- Need visitor role or higher to invite |
| 989 if not self._occupants[current_nick].role then | 989 if not self:get_role(current_nick) or not self:get_default_role(self:get_affiliation(_from)) then |
| 990 origin.send(st.error_reply(stanza, "auth", "forbidden")); | 990 origin.send(st.error_reply(stanza, "auth", "forbidden")); |
| 991 return true; | 991 return true; |
| 992 end | 992 end |
| 993 local _invitee = jid_prep(payload.attr.to); | 993 local _invitee = jid_prep(payload.attr.to); |
| 994 if _invitee then | 994 if _invitee then |
