Software /
code /
prosody-modules
Comparison
mod_rest/mod_rest.lua @ 3796:d1ad10b76b00
mod_rest: Catch one (1) reply to a POST-ed stanza from an internal source
This will primarily cover error replies, and only those generated by the
same Prosody instance using the `origin.reply()` method.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 30 Dec 2019 05:14:49 +0100 |
parent | 3795:f51308fcba83 |
child | 3797:ed5d7586a61e |
comparison
equal
deleted
inserted
replaced
3795:f51308fcba83 | 3796:d1ad10b76b00 |
---|---|
61 else | 61 else |
62 return error; | 62 return error; |
63 end | 63 end |
64 end); | 64 end); |
65 elseif payload.name == "message" or payload.name == "presence" then | 65 elseif payload.name == "message" or payload.name == "presence" then |
66 if module:send(payload) then | 66 local origin = {}; |
67 function origin.send(stanza) | |
68 response:send(tostring(stanza)); | |
69 return true; | |
70 end | |
71 response.headers.content_type = "application/xmpp+xml"; | |
72 if module:send(payload, origin) then | |
67 return 202; | 73 return 202; |
68 else | 74 else |
69 return 500; | 75 return 500; |
70 end | 76 end |
71 else | 77 else |