# HG changeset patch # User Kim Alvefur # Date 1512476668 -3600 # Node ID d81ebb1ef5ceaa005b7a04d81e27538b7b7b18a6 # Parent 60d508f411a15d606c7072f07fcc68225765bd1c mod_s2s: Restructure some code diff -r 60d508f411a1 -r d81ebb1ef5ce plugins/mod_s2s/mod_s2s.lua --- a/plugins/mod_s2s/mod_s2s.lua Tue Dec 05 12:35:01 2017 +0100 +++ b/plugins/mod_s2s/mod_s2s.lua Tue Dec 05 13:24:28 2017 +0100 @@ -106,8 +106,15 @@ (host.log or log)("debug", "trying to send over unauthed s2sout to "..to_host); -- Queue stanza until we are able to send it - if host.sendq then t_insert(host.sendq, {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)}); - else host.sendq = { {tostring(stanza), stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza)} }; end + local queued_item = { + tostring(stanza), + stanza.attr.type ~= "error" and stanza.attr.type ~= "result" and st.reply(stanza); + }; + if host.sendq then + t_insert(host.sendq, queued_item); + else + host.sendq = { queued_item }; + end host.log("debug", "stanza [%s] queued ", stanza.name); return true; elseif host.type == "local" or host.type == "component" then