Mercurial > prosody-hg
comparison plugins/mod_mam/mod_mam.lua @ 7839:f3e1925f29c2
mod_mam: Update to XEP-0313 v0.5.1
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 04 Nov 2016 13:59:49 +0100 |
| parents | e5d5e5946af5 |
| children | 92b6aa3ea2ce |
comparison
equal
deleted
inserted
replaced
| 7838:e5d5e5946af5 | 7839:f3e1925f29c2 |
|---|---|
| 1 -- XEP-0313: Message Archive Management for Prosody | 1 -- XEP-0313: Message Archive Management for Prosody |
| 2 -- Copyright (C) 2011-2016 Kim Alvefur | 2 -- Copyright (C) 2011-2016 Kim Alvefur |
| 3 -- | 3 -- |
| 4 -- This file is MIT/X11 licensed. | 4 -- This file is MIT/X11 licensed. |
| 5 | 5 |
| 6 local xmlns_mam = "urn:xmpp:mam:0"; | 6 local xmlns_mam = "urn:xmpp:mam:1"; |
| 7 local xmlns_delay = "urn:xmpp:delay"; | 7 local xmlns_delay = "urn:xmpp:delay"; |
| 8 local xmlns_forward = "urn:xmpp:forward:0"; | 8 local xmlns_forward = "urn:xmpp:forward:0"; |
| 9 | 9 |
| 10 local um = require "core.usermanager"; | 10 local um = require "core.usermanager"; |
| 11 local st = require "util.stanza"; | 11 local st = require "util.stanza"; |
| 140 origin.send(st.error_reply(stanza, "cancel", "internal-server-error", err)); | 140 origin.send(st.error_reply(stanza, "cancel", "internal-server-error", err)); |
| 141 return true; | 141 return true; |
| 142 end | 142 end |
| 143 local total = tonumber(err); | 143 local total = tonumber(err); |
| 144 | 144 |
| 145 origin.send(st.reply(stanza)); | |
| 146 local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to }; | 145 local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to }; |
| 147 | 146 |
| 148 local results = {}; | 147 local results = {}; |
| 149 | 148 |
| 150 -- Wrap it in stuff and deliver | 149 -- Wrap it in stuff and deliver |
| 186 end | 185 end |
| 187 | 186 |
| 188 -- That's all folks! | 187 -- That's all folks! |
| 189 module:log("debug", "Archive query %s completed", tostring(qid)); | 188 module:log("debug", "Archive query %s completed", tostring(qid)); |
| 190 | 189 |
| 191 origin.send(st.message(msg_reply_attr) | 190 origin.send(st.reply(stanza) |
| 192 :tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete }) | 191 :tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete }) |
| 193 :add_child(rsm.generate { | 192 :add_child(rsm.generate { |
| 194 first = first, last = last, count = total })); | 193 first = first, last = last, count = total })); |
| 195 return true; | 194 return true; |
| 196 end); | 195 end); |
