changeset 256:57de4a7840ef

mod_smacks: Fixes for storing the unacked stanzas so that they can be properly replayed to clients on stream resume
author Matthew Wild <mwild1@gmail.com>
date Thu, 07 Oct 2010 16:16:49 +0100
parents 9b9b089407b1
children 08fa42e1ab06
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Thu Oct 07 16:14:31 2010 +0100
+++ b/mod_smacks/mod_smacks.lua	Thu Oct 07 16:16:49 2010 +0100
@@ -34,7 +34,7 @@
 			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);
+					queue[#queue+1] = st.clone(stanza);
 				end
 				local ok, err = _send(stanza);
 				if ok and #queue > max_unacked_stanzas and not session.awaiting_ack then
@@ -107,12 +107,12 @@
 	if #queue > 0 then
 		session.outgoing_stanza_queue = {};
 		for i=1,#queue do
-			local reply = queue[i];
+			local reply = st.reply(queue[i]);
 			if reply.attr.to ~= session.full_jid then
 				reply.attr.type = "error";
 				reply:tag("error", error_attr)
 					:tag("recipient-unavailable", {xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"});
-				core_process_stanza(session, queue[i]);
+				core_process_stanza(session, reply);
 			end
 		end
 	end