Comparison

plugins/mod_csi_simple.lua @ 9631:d6104aaf94bc 0.11

mod_csi_simple: Skip delay tags on objects other than stanzas (thanks quest) This may be triggered by sending strings, eg as done by mod_c2s for keepalives, stream errors, "</stream>".
author Kim Alvefur <zash@zash.se>
date Sat, 17 Nov 2018 15:28:49 +0100
parent 9589:aeb054ee88c5
child 9632:fdefc43bffff
comparison
equal deleted inserted replaced
9630:bff66c3faceb 9631:d6104aaf94bc
80 function session.send(stanza) 80 function session.send(stanza)
81 if module:fire_event("csi-stanza-is-important", { stanza = stanza, session = session }) then 81 if module:fire_event("csi-stanza-is-important", { stanza = stanza, session = session }) then
82 pump:flush(); 82 pump:flush();
83 send(stanza); 83 send(stanza);
84 else 84 else
85 stanza = st.clone(stanza); 85 if st.is_stanza(stanza) then
86 stanza:add_direct_child(st.stanza("delay", {xmlns = "urn:xmpp:delay", from = bare_jid, stamp = dt.datetime()})); 86 stanza = st.clone(stanza);
87 stanza:add_direct_child(st.stanza("delay", {xmlns = "urn:xmpp:delay", from = bare_jid, stamp = dt.datetime()}));
88 end
87 pump:push(stanza); 89 pump:push(stanza);
88 end 90 end
89 return true; 91 return true;
90 end 92 end
91 end 93 end