# HG changeset patch # User Kim Alvefur # Date 1412765781 -7200 # Node ID 9475fe14d58da742ee3c961d311bb4b89eb6a4dd # Parent 8ac4438925cf850c90efe9954536c59c2a593d53 mod_smacks: Correctly check if what is being sent is a stanza diff -r 8ac4438925cf -r 9475fe14d58d mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Tue Sep 30 01:17:10 2014 +0200 +++ b/mod_smacks/mod_smacks.lua Wed Oct 08 12:56:21 2014 +0200 @@ -82,8 +82,9 @@ local _send = session.sends2s or session.send; local function new_send(stanza) - local xmlns = stanza.attr and stanza.attr.xmlns; - if not xmlns then -- Stanza in default stream namespace + local is_stanza = stanza.attr and not stanza.attr.xmlns; + if is_stanza then -- Stanza in default stream namespace + module:log("debug", "st.clone( %s ) -- %s a stanza", tostring(stanza), is_stanza and "is" or "is not"); local cached_stanza = st.clone(stanza); if cached_stanza and cached_stanza:get_child("delay", xmlns_delay) == nil then @@ -100,7 +101,7 @@ return true; end local ok, err = _send(stanza); - if ok and #queue > max_unacked_stanzas and not session.awaiting_ack and not xmlns then + if ok and #queue > max_unacked_stanzas and not session.awaiting_ack and is_stanza then session.awaiting_ack = true; return _send(st.stanza("r", sm_attr)); end