Comparison

mod_mam_muc/mod_mam_muc.lua @ 2507:b8a66805459e

mod_mam_muc: Update to XEP-0313 0.5.1
author Kim Alvefur <zash@zash.se>
date Mon, 20 Feb 2017 00:05:14 +0100
parent 2502:f576ac1cad65
child 2626:17883c405df3
comparison
equal deleted inserted replaced
2506:5941aac79f06 2507:b8a66805459e
6 if module:get_host_type() ~= "component" then 6 if module:get_host_type() ~= "component" then
7 module:log("error", "mod_%s should be loaded only on a MUC component, not normal hosts", module.name); 7 module:log("error", "mod_%s should be loaded only on a MUC component, not normal hosts", module.name);
8 return; 8 return;
9 end 9 end
10 10
11 local xmlns_mam = "urn:xmpp:mam:0"; 11 local xmlns_mam = "urn:xmpp:mam:1";
12 local xmlns_delay = "urn:xmpp:delay"; 12 local xmlns_delay = "urn:xmpp:delay";
13 local xmlns_forward = "urn:xmpp:forward:0"; 13 local xmlns_forward = "urn:xmpp:forward:0";
14 local muc_form_enable_logging = "muc#roomconfig_enablelogging" 14 local muc_form_enable_logging = "muc#roomconfig_enablelogging"
15 15
16 local st = require "util.stanza"; 16 local st = require "util.stanza";
217 origin.send(st.error_reply(stanza, "cancel", "internal-server-error")); 217 origin.send(st.error_reply(stanza, "cancel", "internal-server-error"));
218 return true; 218 return true;
219 end 219 end
220 local total = tonumber(err); 220 local total = tonumber(err);
221 221
222 origin.send(st.reply(stanza))
223 local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to }; 222 local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to };
224 223
225 local results = {}; 224 local results = {};
226 225
227 -- Wrap it in stuff and deliver 226 -- Wrap it in stuff and deliver
263 end 262 end
264 263
265 -- That's all folks! 264 -- That's all folks!
266 module:log("debug", "Archive query %s completed", tostring(qid)); 265 module:log("debug", "Archive query %s completed", tostring(qid));
267 266
268 origin.send(st.message(msg_reply_attr) 267 origin.send(st.reply(stanza)
269 :tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete }) 268 :tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete })
270 :add_child(rsm.generate { 269 :add_child(rsm.generate {
271 first = first, last = last, count = total })); 270 first = first, last = last, count = total }));
272 return true; 271 return true;
273 end); 272 end);