Software /
code /
prosody
Comparison
plugins/muc/members_only.lib.lua @ 10449:2e36a54906e4
MUC: Indicate that the room is the origin of various errors where 'from' is an occupant JID
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 25 Nov 2019 23:52:45 +0100 |
parent | 9716:5281a795d6df |
child | 11560:3bbb1af92514 |
comparison
equal
deleted
inserted
replaced
10448:cbe524ed1a6a | 10449:2e36a54906e4 |
---|---|
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 |