changeset 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 7761360ffb7b
children 6ad72bd9a7ec
files plugins/mod_csi_simple.lua
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua	Tue Jul 22 16:34:56 2025 +0100
+++ b/plugins/mod_csi_simple.lua	Fri Jul 25 20:33:38 2025 +0200
@@ -11,6 +11,7 @@
 local dt = require "prosody.util.datetime";
 local filters = require "prosody.util.filters";
 local timer = require "prosody.util.timer";
+local jid_bare = require "prosody.util.jid".bare;
 
 local queue_size = module:get_option_integer("csi_queue_size", 256, 1);
 local resume_delay = module:get_option_period("csi_resume_inactive_delay", 5);
@@ -40,13 +41,18 @@
 		-- TODO Some MUC awareness, e.g. check for the 'this relates to you' status code
 		return true, "subscription request";
 	elseif st_name == "message" then
+		if st_type == "error" then
+			return true, "delivery failure";
+		end
+		if stanza:get_child("event", "http://jabber.org/protocol/pubsub#event") then
+			if stanza.attr.from == nil or stanza.attr.from == jid_bare(stanza.attr.to) then
+				return true, "self-pep-event";
+			end
+		end
 		if st_type == "headline" then
 			-- Headline messages are ephemeral by definition
 			return false, "headline";
 		end
-		if st_type == "error" then
-			return true, "delivery failure";
-		end
 		if stanza:get_child("sent", "urn:xmpp:carbons:2") then
 			return true, "carbon";
 		end