Software /
code /
verse
Annotate
plugins/archive.lua @ 473:b2198cd64c5a
disco: Add support for extended disco forms
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 17 Mar 2023 11:12:01 +0000 |
parent | 462:51c3da615ff4 |
child | 490:6b2f31da9610 |
rev | line source |
---|---|
291
b78137f5118e
plugins.archive: Add a header comment
Kim Alvefur <zash@zash.se>
parents:
275
diff
changeset
|
1 -- This implements XEP-0313: Message Archive Management |
b78137f5118e
plugins.archive: Add a header comment
Kim Alvefur <zash@zash.se>
parents:
275
diff
changeset
|
2 -- http://xmpp.org/extensions/xep-0313.html |
b78137f5118e
plugins.archive: Add a header comment
Kim Alvefur <zash@zash.se>
parents:
275
diff
changeset
|
3 -- (ie not XEP-0136) |
b78137f5118e
plugins.archive: Add a header comment
Kim Alvefur <zash@zash.se>
parents:
275
diff
changeset
|
4 |
292
b674f5ca85d4
plugins.archive: Add local verse
Kim Alvefur <zash@zash.se>
parents:
291
diff
changeset
|
5 local verse = require "verse"; |
293
65fb9ae79014
plugins.archive: Import util.stanza directly and use it
Kim Alvefur <zash@zash.se>
parents:
292
diff
changeset
|
6 local st = require "util.stanza"; |
409
171c4a8cc3de
plugins.archive: Update to XEP-0313 v0.6
Kim Alvefur <zash@zash.se>
parents:
380
diff
changeset
|
7 local xmlns_mam = "urn:xmpp:mam:2" |
295
5f7203bf1dae
plugins.archive: Move namespaces to the top
Kim Alvefur <zash@zash.se>
parents:
294
diff
changeset
|
8 local xmlns_forward = "urn:xmpp:forward:0"; |
5f7203bf1dae
plugins.archive: Move namespaces to the top
Kim Alvefur <zash@zash.se>
parents:
294
diff
changeset
|
9 local xmlns_delay = "urn:xmpp:delay"; |
457
73d4eb93657b
Update to use util.id for random ids instead of counters (thanks Zash)
Matthew Wild <mwild1@gmail.com>
parents:
428
diff
changeset
|
10 local new_id = require "util.id".short; |
297
447dffdaf46c
plugins.archive: Parse the timestamp
Kim Alvefur <zash@zash.se>
parents:
296
diff
changeset
|
11 local parse_datetime = require "util.datetime".parse; |
303
0dda04d5eb84
plugins.archive: Treat query params correctly
Kim Alvefur <zash@zash.se>
parents:
297
diff
changeset
|
12 local datetime = require "util.datetime".datetime; |
353
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
13 local dataform = require"util.dataforms".new; |
304
e09ae2395d41
squishy, plugins.archive: Fetch RSM lib from prosody-modules and use.
Kim Alvefur <zash@zash.se>
parents:
303
diff
changeset
|
14 local rsm = require "util.rsm"; |
e09ae2395d41
squishy, plugins.archive: Fetch RSM lib from prosody-modules and use.
Kim Alvefur <zash@zash.se>
parents:
303
diff
changeset
|
15 local NULL = {}; |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 |
353
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
17 local query_form = dataform { |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
18 { name = "FORM_TYPE"; type = "hidden"; value = xmlns_mam; }; |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
19 { name = "with"; type = "jid-single"; }; |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
20 { name = "start"; type = "text-single" }; |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
21 { name = "end"; type = "text-single"; }; |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
22 }; |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
23 |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 function verse.plugins.archive(stream) |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 function stream:query_archive(where, query_params, callback) |
457
73d4eb93657b
Update to use util.id for random ids instead of counters (thanks Zash)
Matthew Wild <mwild1@gmail.com>
parents:
428
diff
changeset
|
26 local queryid = new_id(); |
73d4eb93657b
Update to use util.id for random ids instead of counters (thanks Zash)
Matthew Wild <mwild1@gmail.com>
parents:
428
diff
changeset
|
27 local query_st = st.iq{ id = queryid, type="set", to = where } |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 :tag("query", { xmlns = xmlns_mam, queryid = queryid }); |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 |
380 | 30 |
303
0dda04d5eb84
plugins.archive: Treat query params correctly
Kim Alvefur <zash@zash.se>
parents:
297
diff
changeset
|
31 local qstart, qend = tonumber(query_params["start"]), tonumber(query_params["end"]); |
353
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
32 query_params["start"] = qstart and datetime(qstart); |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
33 query_params["end"] = qend and datetime(qend); |
304
e09ae2395d41
squishy, plugins.archive: Fetch RSM lib from prosody-modules and use.
Kim Alvefur <zash@zash.se>
parents:
303
diff
changeset
|
34 |
353
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
35 query_st:add_child(query_form:form(query_params, "submit")); |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
36 -- query_st:up(); |
305
4a0206505b9d
plugins.archive: Don't modify the query params table
Kim Alvefur <zash@zash.se>
parents:
304
diff
changeset
|
37 query_st:add_child(rsm.generate(query_params)); |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 local results = {}; |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 local function handle_archived_message(message) |
353
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
41 |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 local result_tag = message:get_child("result", xmlns_mam); |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 if result_tag and result_tag.attr.queryid == queryid then |
345
266a96ae4c0d
plugins.archive: Update for MAM 0.2
Kim Alvefur <zash@zash.se>
parents:
305
diff
changeset
|
44 local forwarded = result_tag:get_child("forwarded", xmlns_forward); |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 |
296
78ddfd30c74e
plugins.archive: Collect the archive id
Kim Alvefur <zash@zash.se>
parents:
295
diff
changeset
|
46 local id = result_tag.attr.id; |
295
5f7203bf1dae
plugins.archive: Move namespaces to the top
Kim Alvefur <zash@zash.se>
parents:
294
diff
changeset
|
47 local delay = forwarded:get_child("delay", xmlns_delay); |
297
447dffdaf46c
plugins.archive: Parse the timestamp
Kim Alvefur <zash@zash.se>
parents:
296
diff
changeset
|
48 local stamp = delay and parse_datetime(delay.attr.stamp) or nil; |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
49 |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 local message = forwarded:get_child("message", "jabber:client") |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
51 |
296
78ddfd30c74e
plugins.archive: Collect the archive id
Kim Alvefur <zash@zash.se>
parents:
295
diff
changeset
|
52 results[#results+1] = { id = id, stamp = stamp, message = message }; |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
53 return true |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
54 end |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
55 end |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
56 |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
57 self:hook("message", handle_archived_message, 1); |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
58 self:send_iq(query_st, function(reply) |
409
171c4a8cc3de
plugins.archive: Update to XEP-0313 v0.6
Kim Alvefur <zash@zash.se>
parents:
380
diff
changeset
|
59 self:unhook("message", handle_archived_message); |
353
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
60 if reply.attr.type == "error" then |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
61 self:warn(table.concat({reply:get_error()}, " ")) |
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
62 callback(false, reply:get_error()) |
409
171c4a8cc3de
plugins.archive: Update to XEP-0313 v0.6
Kim Alvefur <zash@zash.se>
parents:
380
diff
changeset
|
63 return true; |
353
8cd05c3d0f1f
plugins.archive: Update to MAM version 0.3
Kim Alvefur <zash@zash.se>
parents:
345
diff
changeset
|
64 end |
428
bde804b01f28
Fix typos (thanks Link Mauve and codespell)
Kim Alvefur <zash@zash.se>
parents:
427
diff
changeset
|
65 local finished = reply:get_child("fin", xmlns_mam) |
bde804b01f28
Fix typos (thanks Link Mauve and codespell)
Kim Alvefur <zash@zash.se>
parents:
427
diff
changeset
|
66 if finished then |
462
51c3da615ff4
archive: Add 'complete' flag
Matthew Wild <mwild1@gmail.com>
parents:
457
diff
changeset
|
67 results.complete = finished.attr.complete == "true" or finished.attr.complete == "1"; |
428
bde804b01f28
Fix typos (thanks Link Mauve and codespell)
Kim Alvefur <zash@zash.se>
parents:
427
diff
changeset
|
68 local rset = rsm.get(finished); |
409
171c4a8cc3de
plugins.archive: Update to XEP-0313 v0.6
Kim Alvefur <zash@zash.se>
parents:
380
diff
changeset
|
69 for k,v in pairs(rset or NULL) do results[k]=v; end |
171c4a8cc3de
plugins.archive: Update to XEP-0313 v0.6
Kim Alvefur <zash@zash.se>
parents:
380
diff
changeset
|
70 end |
413
41c67bf8c010
plugins.archive: Call callback even f there were no <fin> element
Kim Alvefur <zash@zash.se>
parents:
412
diff
changeset
|
71 callback(results); |
41c67bf8c010
plugins.archive: Call callback even f there were no <fin> element
Kim Alvefur <zash@zash.se>
parents:
412
diff
changeset
|
72 return true |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
73 end); |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
74 end |
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
75 |
294
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
76 local default_attrs = { |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
77 always = true, [true] = "always", |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
78 never = false, [false] = "never", |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
79 roster = "roster", |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
80 } |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
81 |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
82 local function prefs_decode(stanza) -- from XML |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
83 local prefs = {}; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
84 local default = stanza.attr.default; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
85 |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
86 if default then |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
87 prefs[false] = default_attrs[default]; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
88 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
89 |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
90 local always = stanza:get_child("always"); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
91 if always then |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
92 for rule in always:childtags("jid") do |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
93 local jid = rule:get_text(); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
94 prefs[jid] = true; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
95 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
96 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
97 |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
98 local never = stanza:get_child("never"); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
99 if never then |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
100 for rule in never:childtags("jid") do |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
101 local jid = rule:get_text(); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
102 prefs[jid] = false; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
103 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
104 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
105 return prefs; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
106 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
107 |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
108 local function prefs_encode(prefs) -- into XML |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
109 local default |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
110 default, prefs[false] = prefs[false], nil; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
111 if default ~= nil then |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
112 default = default_attrs[default]; |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
113 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
114 local reply = st.stanza("prefs", { xmlns = xmlns_mam, default = default }) |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
115 local always = st.stanza("always"); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
116 local never = st.stanza("never"); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
117 for k,v in pairs(prefs) do |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
118 (v and always or never):tag("jid"):text(k):up(); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
119 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
120 return reply:add_child(always):add_child(never); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
121 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
122 |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
123 function stream:archive_prefs_get(callback) |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
124 self:send_iq(st.iq{ type="get" }:tag("prefs", { xmlns = xmlns_mam }), |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
125 function(result) |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
126 if result and result.attr.type == "result" and result.tags[1] then |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
127 local prefs = prefs_decode(result.tags[1]); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
128 callback(prefs, result); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
129 else |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
130 callback(nil, result); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
131 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
132 end); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
133 end |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
134 |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
135 function stream:archive_prefs_set(prefs, callback) |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
136 self:send_iq(st.iq{ type="set" }:add_child(prefs_encode(prefs)), callback); |
ac039aa3a4ef
plugins.archive: Implement archiving preferences
Kim Alvefur <zash@zash.se>
parents:
293
diff
changeset
|
137 end |
273
c5b7a4c717a6
plugins.archive: Experimental implementation of the Message Archive Management ProtoXEP
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
138 end |