aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-03 01:02:02 +0100
committerKim Alvefur <zash@zash.se>2021-12-03 01:02:02 +0100
commitca41268d26c0ccd45502e7c14bf31ca0f3b6410d (patch)
treefe503c47df038d8021a41c36fbab711c3982be18
parent9f22150bc88fdaf58d80a3e71e4bbf8a0b49dc77 (diff)
downloadprosody-ca41268d26c0ccd45502e7c14bf31ca0f3b6410d.tar.gz
prosody-ca41268d26c0ccd45502e7c14bf31ca0f3b6410d.zip
mod_smacks: Refactor, simplify, optimize
Since reply.attr.to will be the .attr.from of the input we can check this earlier and avoid constructing the reply at all.
-rw-r--r--plugins/mod_smacks.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua
index c9b01371..bb27b05f 100644
--- a/plugins/mod_smacks.lua
+++ b/plugins/mod_smacks.lua
@@ -399,11 +399,9 @@ local function handle_unacked_stanzas(session)
session.outgoing_stanza_queue = {};
for i=1,#queue do
if not module:fire_event("delivery/failure", { session = session, stanza = queue[i] }) then
- if queue[i].attr.type ~= "error" then
+ if queue[i].attr.type ~= "error" and queue[i].attr.from ~= session.full_jid then
local reply = st.error_reply(queue[i], "cancel", "recipient-unavailable");
- if reply.attr.to ~= session.full_jid then
- core_process_stanza(session, reply);
- end
+ core_process_stanza(session, reply);
end
end
end