# HG changeset patch # User Kim Alvefur # Date 1577679532 -3600 # Node ID 9b4fd2553365cda4b0671fb847f3290567148eb3 # Parent ed5d7586a61eef4e52dafc902b499602cdfebed2 mod_rest: Handle receipt requests on message stanzas diff -r ed5d7586a61e -r 9b4fd2553365 mod_rest/mod_rest.lua --- a/mod_rest/mod_rest.lua Mon Dec 30 05:17:18 2019 +0100 +++ b/mod_rest/mod_rest.lua Mon Dec 30 05:18:52 2019 +0100 @@ -120,6 +120,12 @@ local function handle_stanza(event) local stanza, origin = event.stanza, event.origin; local reply_needed = stanza.name == "iq"; + local receipt; + + if stanza.name == "message" and stanza.attr.id and stanza:get_child("urn:xmpp:receipts", "request") then + reply_needed = true; + receipt = st.stanza("received", { xmlns = "urn:xmpp:receipts", id = stanza.id }); + end http.request(rest_url, { body = tostring(stanza), @@ -179,6 +185,10 @@ end end + if receipt then + reply:add_direct_child(receipt); + end + origin.send(reply); end);