From 5f98d0cc2359f1ab55b7af8179981592a3508faa Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 22 Mar 2023 11:39:19 +0000 Subject: mod_pubsub, mod_pep: Support per-node configurable inclusion of publisher This matches ejabberd's behaviour, using the 'pubsub#itemreply' config option. Although the current definition of this option in the specification is not as clear as it could be, I think matching what existing deployments do is the best option to resolve the ambiguity and reduce fragmentation. We should update the spec to be clearer about how to use and interpret this option. The 'expose_publisher' option for mod_pubsub is now an override (always expose or never expose). If unset, it will use the per-node config (which defaults to not exposing). Thanks to Link Mauve, edhelas and goffi for sparking this feature. --- plugins/mod_pep.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'plugins/mod_pep.lua') diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua index 71e45e7c..c7afde6f 100644 --- a/plugins/mod_pep.lua +++ b/plugins/mod_pep.lua @@ -136,10 +136,14 @@ end local function get_broadcaster(username) local user_bare = jid_join(username, host); local function simple_broadcast(kind, node, jids, item, _, node_obj) + local expose_publisher; if node_obj then if node_obj.config["notify_"..kind] == false then return; end + if node_obj.config.itemreply == "publisher" then + expose_publisher = true; + end end if kind == "retract" then kind = "items"; -- XEP-0060 signals retraction in an container @@ -151,6 +155,9 @@ local function get_broadcaster(username) if node_obj and node_obj.config.include_payload == false then item:maptags(function () return nil; end); end + if not expose_publisher then + item.attr.publisher = nil; + end end end -- cgit v1.2.3