Software /
code /
prosody
Comparison
plugins/mod_external_services.lua @ 12432:60eecdd9c65b
Merge 0.12->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 23 Mar 2022 16:25:37 +0100 |
parent | 12431:95f33a006c03 |
child | 12685:4d75663d1552 |
comparison
equal
deleted
inserted
replaced
12430:0c1684c65716 | 12432:60eecdd9c65b |
---|---|
190 local function handle_credentials(event) | 190 local function handle_credentials(event) |
191 local origin, stanza = event.origin, event.stanza; | 191 local origin, stanza = event.origin, event.stanza; |
192 local action = stanza.tags[1]; | 192 local action = stanza.tags[1]; |
193 | 193 |
194 if origin.type ~= "c2s" then | 194 if origin.type ~= "c2s" then |
195 origin.send(st.error_reply(stanza, "auth", "forbidden", "The 'port' and 'type' attributes are required.")); | 195 origin.send(st.error_reply(stanza, "auth", "forbidden")); |
196 return true; | 196 return true; |
197 end | 197 end |
198 | 198 |
199 local services = get_services(); | 199 local services = get_services(); |
200 services:filter(function (item) | 200 services:filter(function (item) |
202 end) | 202 end) |
203 | 203 |
204 local requested_credentials = set.new(); | 204 local requested_credentials = set.new(); |
205 for service in action:childtags("service") do | 205 for service in action:childtags("service") do |
206 if not service.attr.type or not service.attr.host then | 206 if not service.attr.type or not service.attr.host then |
207 origin.send(st.error_reply(stanza, "modify", "bad-request")); | 207 origin.send(st.error_reply(stanza, "modify", "bad-request", "The 'port' and 'type' attributes are required.")); |
208 return true; | 208 return true; |
209 end | 209 end |
210 | 210 |
211 requested_credentials:add(string.format("%s:%s:%d", service.attr.type, service.attr.host, | 211 requested_credentials:add(string.format("%s:%s:%d", service.attr.type, service.attr.host, |
212 tonumber(service.attr.port) or 0)); | 212 tonumber(service.attr.port) or 0)); |