Mercurial > prosody-hg
comparison plugins/muc/members_only.lib.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Nov 2020 22:31:25 +0100 |
| parents | 2e36a54906e4 |
| children | 3bbb1af92514 |
comparison
equal
deleted
inserted
replaced
| 11199:6c7c50a4de32 | 11200:bf8f2da84007 |
|---|---|
| 111 local room = event.room; | 111 local room = event.room; |
| 112 if get_members_only(room) then | 112 if get_members_only(room) then |
| 113 local stanza = event.stanza; | 113 local stanza = event.stanza; |
| 114 local affiliation = room:get_affiliation(stanza.attr.from); | 114 local affiliation = room:get_affiliation(stanza.attr.from); |
| 115 if valid_affiliations[affiliation or "none"] <= valid_affiliations.none then | 115 if valid_affiliations[affiliation or "none"] <= valid_affiliations.none then |
| 116 local reply = st.error_reply(stanza, "auth", "registration-required"):up(); | 116 local reply = st.error_reply(stanza, "auth", "registration-required", nil, room.jid):up(); |
| 117 reply.tags[1].attr.code = "407"; | 117 reply.tags[1].attr.code = "407"; |
| 118 event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); | 118 event.origin.send(reply:tag("x", {xmlns = "http://jabber.org/protocol/muc"})); |
| 119 return true; | 119 return true; |
| 120 end | 120 end |
| 121 end | 121 end |
| 129 if get_members_only(room) then | 129 if get_members_only(room) then |
| 130 local stanza = event.stanza; | 130 local stanza = event.stanza; |
| 131 local inviter_affiliation = room:get_affiliation(stanza.attr.from) or "none"; | 131 local inviter_affiliation = room:get_affiliation(stanza.attr.from) or "none"; |
| 132 local required_affiliation = room._data.allow_member_invites and "member" or "admin"; | 132 local required_affiliation = room._data.allow_member_invites and "member" or "admin"; |
| 133 if valid_affiliations[inviter_affiliation] < valid_affiliations[required_affiliation] then | 133 if valid_affiliations[inviter_affiliation] < valid_affiliations[required_affiliation] then |
| 134 event.origin.send(st.error_reply(stanza, "auth", "forbidden")); | 134 event.origin.send(st.error_reply(stanza, "auth", "forbidden", nil, room.jid)); |
| 135 return true; | 135 return true; |
| 136 end | 136 end |
| 137 end | 137 end |
| 138 end); | 138 end); |
| 139 | 139 |
