From 23be1afef652d71745c7b0aa7a9786bad95e3f3f Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 17 Nov 2018 15:28:49 +0100 Subject: 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, "". --- plugins/mod_csi_simple.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_csi_simple.lua b/plugins/mod_csi_simple.lua index 1535edae..6fc88291 100644 --- a/plugins/mod_csi_simple.lua +++ b/plugins/mod_csi_simple.lua @@ -82,8 +82,10 @@ module:hook("csi-client-inactive", function (event) pump:flush(); send(stanza); else - stanza = st.clone(stanza); - stanza:add_direct_child(st.stanza("delay", {xmlns = "urn:xmpp:delay", from = bare_jid, stamp = dt.datetime()})); + if st.is_stanza(stanza) then + stanza = st.clone(stanza); + stanza:add_direct_child(st.stanza("delay", {xmlns = "urn:xmpp:delay", from = bare_jid, stamp = dt.datetime()})); + end pump:push(stanza); end return true; -- cgit v1.2.3 From 3d3e0fa0826c0d107a7b99d875190ba4421f668a Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 17 Nov 2018 15:36:10 +0100 Subject: mod_csi_simple: Consider non-stanza objects important Most cases are for keepalive or stream closing, where it needs to be flushed anyways. --- plugins/mod_csi_simple.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_csi_simple.lua b/plugins/mod_csi_simple.lua index 6fc88291..c8151df5 100644 --- a/plugins/mod_csi_simple.lua +++ b/plugins/mod_csi_simple.lua @@ -48,6 +48,9 @@ local queue_size = module:get_option_number("csi_queue_size", 256); module:hook("csi-is-stanza-important", function (event) local stanza = event.stanza; + if not st.is_stanza(stanza) then + return true; + end local st_name = stanza.name; if not st_name then return false; end local st_type = stanza.attr.type; -- cgit v1.2.3