Comparison

mod_mam/mamprefsxml.lib.lua @ 2506:5941aac79f06

mod_mam: Add support for XEP-0313 v0.5
author Kim Alvefur <zash@zash.se>
date Mon, 20 Feb 2017 00:41:13 +0100
parent 2014:dfa9c0cdd960
comparison
equal deleted inserted replaced
2505:1398f3f76c0f 2506:5941aac79f06
2 -- Copyright (C) 2011-2013 Kim Alvefur 2 -- Copyright (C) 2011-2013 Kim Alvefur
3 -- 3 --
4 -- This file is MIT/X11 licensed. 4 -- This file is MIT/X11 licensed.
5 5
6 local st = require"util.stanza"; 6 local st = require"util.stanza";
7 local xmlns_mam = "urn:xmpp:mam:0";
8 7
9 local default_attrs = { 8 local default_attrs = {
10 always = true, [true] = "always", 9 always = true, [true] = "always",
11 never = false, [false] = "never", 10 never = false, [false] = "never",
12 roster = "roster", 11 roster = "roster",
13 } 12 }
14 13
15 local function tostanza(prefs) 14 local function tostanza(prefs, xmlns_mam)
16 local default = prefs[false]; 15 local default = prefs[false];
17 default = default_attrs[default]; 16 default = default_attrs[default];
18 local prefstanza = st.stanza("prefs", { xmlns = xmlns_mam, default = default }); 17 local prefstanza = st.stanza("prefs", { xmlns = xmlns_mam, default = default });
19 local always = st.stanza("always"); 18 local always = st.stanza("always");
20 local never = st.stanza("never"); 19 local never = st.stanza("never");