comparison mod_smacks/mod_smacks.lua @ 2756:dbba101601b4

mod_smacks: Fix #921 See also https://mail.jabber.org/pipermail/standards/2017-May/032773.html
author tmolitor <thilo@eightysoft.de>
date Sun, 27 Aug 2017 21:34:48 +0200
parents f70c02c14161
children e672d1050529
comparison
equal deleted inserted replaced
2755:dbab58abd3e2 2756:dbba101601b4
13 13
14 local st = require "util.stanza"; 14 local st = require "util.stanza";
15 local dep = require "util.dependencies"; 15 local dep = require "util.dependencies";
16 local cache = dep.softreq("util.cache"); -- only available in prosody 0.10+ 16 local cache = dep.softreq("util.cache"); -- only available in prosody 0.10+
17 local uuid_generate = require "util.uuid".generate; 17 local uuid_generate = require "util.uuid".generate;
18 local jid = require "util.jid";
18 19
19 local t_insert, t_remove = table.insert, table.remove; 20 local t_insert, t_remove = table.insert, table.remove;
20 local math_min = math.min; 21 local math_min = math.min;
21 local os_time = os.time; 22 local os_time = os.time;
22 local tonumber, tostring = tonumber, tostring; 23 local tonumber, tostring = tonumber, tostring;
190 local queue = session.outgoing_stanza_queue; 191 local queue = session.outgoing_stanza_queue;
191 local cached_stanza = st.clone(stanza); 192 local cached_stanza = st.clone(stanza);
192 cached_stanza._cached = true; 193 cached_stanza._cached = true;
193 194
194 if cached_stanza and cached_stanza.name ~= "iq" and cached_stanza:get_child("delay", xmlns_delay) == nil then 195 if cached_stanza and cached_stanza.name ~= "iq" and cached_stanza:get_child("delay", xmlns_delay) == nil then
195 cached_stanza = cached_stanza:tag("delay", { xmlns = xmlns_delay, from = session.host, stamp = datetime.datetime()}); 196 cached_stanza = cached_stanza:tag("delay", {
197 xmlns = xmlns_delay,
198 from = jid.bare(session.full_jid or session.host),
199 stamp = datetime.datetime()
200 });
196 end 201 end
197 202
198 queue[#queue+1] = cached_stanza; 203 queue[#queue+1] = cached_stanza;
199 session.log("debug", "#queue = %d", #queue); 204 session.log("debug", "#queue = %d", #queue);
200 if session.hibernating then 205 if session.hibernating then