comparison plugins/mod_csi_simple.lua @ 13917:598359d9f580

mod_csi_simple: Consider own PEP event broadcasts as high priority This should help keep ones own clients in sync, e.g. with XEP-0490 Check for delivery errors earlier in order to avoid misinterpreting payloads echoed back along with errors.
author Kim Alvefur <zash@zash.se>
date Fri, 25 Jul 2025 20:33:38 +0200
parents 50324f66ca2a
children 0ff11f2e87cd
comparison
equal deleted inserted replaced
13916:7761360ffb7b 13917:598359d9f580
9 local jid = require "prosody.util.jid"; 9 local jid = require "prosody.util.jid";
10 local st = require "prosody.util.stanza"; 10 local st = require "prosody.util.stanza";
11 local dt = require "prosody.util.datetime"; 11 local dt = require "prosody.util.datetime";
12 local filters = require "prosody.util.filters"; 12 local filters = require "prosody.util.filters";
13 local timer = require "prosody.util.timer"; 13 local timer = require "prosody.util.timer";
14 local jid_bare = require "prosody.util.jid".bare;
14 15
15 local queue_size = module:get_option_integer("csi_queue_size", 256, 1); 16 local queue_size = module:get_option_integer("csi_queue_size", 256, 1);
16 local resume_delay = module:get_option_period("csi_resume_inactive_delay", 5); 17 local resume_delay = module:get_option_period("csi_resume_inactive_delay", 5);
17 18
18 local important_payloads = module:get_option_set("csi_important_payloads", { }); 19 local important_payloads = module:get_option_set("csi_important_payloads", { });
38 return false, "presence update"; 39 return false, "presence update";
39 end 40 end
40 -- TODO Some MUC awareness, e.g. check for the 'this relates to you' status code 41 -- TODO Some MUC awareness, e.g. check for the 'this relates to you' status code
41 return true, "subscription request"; 42 return true, "subscription request";
42 elseif st_name == "message" then 43 elseif st_name == "message" then
44 if st_type == "error" then
45 return true, "delivery failure";
46 end
47 if stanza:get_child("event", "http://jabber.org/protocol/pubsub#event") then
48 if stanza.attr.from == nil or stanza.attr.from == jid_bare(stanza.attr.to) then
49 return true, "self-pep-event";
50 end
51 end
43 if st_type == "headline" then 52 if st_type == "headline" then
44 -- Headline messages are ephemeral by definition 53 -- Headline messages are ephemeral by definition
45 return false, "headline"; 54 return false, "headline";
46 end
47 if st_type == "error" then
48 return true, "delivery failure";
49 end 55 end
50 if stanza:get_child("sent", "urn:xmpp:carbons:2") then 56 if stanza:get_child("sent", "urn:xmpp:carbons:2") then
51 return true, "carbon"; 57 return true, "carbon";
52 end 58 end
53 local forwarded = stanza:find("{urn:xmpp:carbons:2}received/{urn:xmpp:forward:0}/{jabber:client}message"); 59 local forwarded = stanza:find("{urn:xmpp:carbons:2}received/{urn:xmpp:forward:0}/{jabber:client}message");