diff mod_smacks/mod_smacks.lua @ 4009:362997ededb1

mod_smacks: don't send error replys for error stanzas on session timeout
author tmolitor <thilo@eightysoft.de>
date Fri, 01 May 2020 22:24:10 +0200
parents 9ec23a457f9a
children 22e7b3d6fcae
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Fri May 01 11:34:43 2020 +0200
+++ b/mod_smacks/mod_smacks.lua	Fri May 01 22:24:10 2020 +0200
@@ -407,12 +407,14 @@
 		session.outgoing_stanza_queue = {};
 		for i=1,#queue do
 			if not module:fire_event("delivery/failure", { session = session, stanza = queue[i] }) then
-				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, reply);
+				if queue[i].attr.type ~= "error" then
+					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, reply);
+					end
 				end
 			end
 		end