# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1542464929 -3600
# Node ID d6104aaf94bcb06e53663d444e014a5de0af8936
# Parent  bff66c3faceb4b2d75ad5e47013efe5f2af59c6b
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>".

diff -r bff66c3faceb -r d6104aaf94bc plugins/mod_csi_simple.lua
--- a/plugins/mod_csi_simple.lua	Sat Nov 17 15:26:11 2018 +0100
+++ b/plugins/mod_csi_simple.lua	Sat Nov 17 15:28:49 2018 +0100
@@ -82,8 +82,10 @@
 				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;