# HG changeset patch # User Matthew Wild # Date 1286464471 -3600 # Node ID 9b9b089407b1dccf783852abdcd3f0f204e0e614 # Parent 9b4a114b2fe67b81dbe8a41a1c404a987fc161bd mod_smacks: Fix to reply to stream for s2s sessions diff -r 9b4a114b2fe6 -r 9b9b089407b1 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Fri Oct 01 16:15:36 2010 +0200 +++ b/mod_smacks/mod_smacks.lua Thu Oct 07 16:14:31 2010 +0100 @@ -30,8 +30,8 @@ local queue = {}; session.outgoing_stanza_queue = queue; session.last_acknowledged_stanza = 0; - local _send = session.send; - function session.send(stanza) + local _send = session.sends2s or session.send; + local function new_send(stanza) local attr = stanza.attr; if attr and not attr.xmlns then -- Stanza in default stream namespace queue[#queue+1] = st.reply(stanza); @@ -44,6 +44,12 @@ return ok, err; end + if session.sends2s then + session.sends2s = new_send; + else + session.send = new_send; + end + session.handled_stanza_count = 0; add_filter(session, "stanzas/in", function (stanza) if not stanza.attr.xmlns then @@ -66,7 +72,7 @@ end module:log("debug", "Received ack request, acking for %d", origin.handled_stanza_count); -- Reply with - origin.send(st.stanza("a", { xmlns = xmlns_sm, h = tostring(origin.handled_stanza_count) })); + (origin.sends2s or origin.send)(st.stanza("a", { xmlns = xmlns_sm, h = tostring(origin.handled_stanza_count) })); return true; end);