Software /
code /
prosody
Comparison
plugins/mod_smacks.lua @ 11997:1ea01660c79a
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 03 Dec 2021 01:02:02 +0100 |
parent | 11996:3dd7886f9342 |
child | 12038:4e54334febc1 |
comparison
equal
deleted
inserted
replaced
11996:3dd7886f9342 | 11997:1ea01660c79a |
---|---|
397 local queue = session.outgoing_stanza_queue; | 397 local queue = session.outgoing_stanza_queue; |
398 if #queue > 0 then | 398 if #queue > 0 then |
399 session.outgoing_stanza_queue = {}; | 399 session.outgoing_stanza_queue = {}; |
400 for i=1,#queue do | 400 for i=1,#queue do |
401 if not module:fire_event("delivery/failure", { session = session, stanza = queue[i] }) then | 401 if not module:fire_event("delivery/failure", { session = session, stanza = queue[i] }) then |
402 if queue[i].attr.type ~= "error" then | 402 if queue[i].attr.type ~= "error" and queue[i].attr.from ~= session.full_jid then |
403 local reply = st.error_reply(queue[i], "cancel", "recipient-unavailable"); | 403 local reply = st.error_reply(queue[i], "cancel", "recipient-unavailable"); |
404 if reply.attr.to ~= session.full_jid then | 404 core_process_stanza(session, reply); |
405 core_process_stanza(session, reply); | |
406 end | |
407 end | 405 end |
408 end | 406 end |
409 end | 407 end |
410 end | 408 end |
411 end | 409 end |