comparison mod_pubsub_text_interface/mod_pubsub_text_interface.lua @ 3247:ada7a0c7221c

mod_pubsub_text_interface: Generate a stanza id for replies This may be needed for some clients that de-duplicate messages based on stanza id.
author Kim Alvefur <zash@zash.se>
date Mon, 20 Aug 2018 22:52:20 +0200
parents ca856a892719
children ecec46f7d020
comparison
equal deleted inserted replaced
3246:2a54b331f011 3247:ada7a0c7221c
1 local st = require "util.stanza"; 1 local st = require "util.stanza";
2 local jid = require "util.jid"; 2 local jid = require "util.jid";
3 local id = require "util.id";
3 4
4 local pubsub = module:depends "pubsub".service; 5 local pubsub = module:depends "pubsub".service;
5 6
6 local name = module:get_option_string("name", "PubSub Service on "..module.host); 7 local name = module:get_option_string("name", "PubSub Service on "..module.host);
7 local help = name..[[ 8 local help = name..[[
21 body = body:lower(); 22 body = body:lower();
22 23
23 local from = stanza.attr.from; 24 local from = stanza.attr.from;
24 25
25 local reply = st.reply(stanza); 26 local reply = st.reply(stanza);
27 reply.attr.id = id.medium();
26 28
27 if body == "help" then 29 if body == "help" then
28 reply:body(help); 30 reply:body(help);
29 elseif body == "list" then 31 elseif body == "list" then
30 local ok, nodes = pubsub:get_nodes(from); 32 local ok, nodes = pubsub:get_nodes(from);