plugins/archive.lua

changeset 293
65fb9ae79014
parent 292
b674f5ca85d4
child 294
ac039aa3a4ef
equal deleted inserted replaced
292:b674f5ca85d4 293:65fb9ae79014
1 -- This implements XEP-0313: Message Archive Management 1 -- This implements XEP-0313: Message Archive Management
2 -- http://xmpp.org/extensions/xep-0313.html 2 -- http://xmpp.org/extensions/xep-0313.html
3 -- (ie not XEP-0136) 3 -- (ie not XEP-0136)
4 4
5 local verse = require "verse"; 5 local verse = require "verse";
6 local st = require "util.stanza";
6 local xmlns_mam = "urn:xmpp:mam:tmp" 7 local xmlns_mam = "urn:xmpp:mam:tmp"
7 local uuid = require "util.uuid".generate; 8 local uuid = require "util.uuid".generate;
8 9
9 function verse.plugins.archive(stream) 10 function verse.plugins.archive(stream)
10 function stream:query_archive(where, query_params, callback) 11 function stream:query_archive(where, query_params, callback)
11 local queryid = uuid(); 12 local queryid = uuid();
12 local query_st = verse.iq{ type="get", to=where } 13 local query_st = st.iq{ type="get", to = where }
13 :tag("query", { xmlns = xmlns_mam, queryid = queryid }); 14 :tag("query", { xmlns = xmlns_mam, queryid = queryid });
14 15
15 local params = { "with", "start", "end" }; 16 local params = { "with", "start", "end" };
16 local query_params = query_params or {}; 17 local query_params = query_params or {};
17 for i=1,#params do 18 for i=1,#params do

mercurial