diff options
author | Matthew Wild <mwild1@gmail.com> | 2023-03-22 11:39:19 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2023-03-22 11:39:19 +0000 |
commit | 5f98d0cc2359f1ab55b7af8179981592a3508faa (patch) | |
tree | 5bf9d380584bd3a4bb2b71c16442f59ae0c4a1f5 /plugins/mod_pep.lua | |
parent | 14f896bf2d8f4a00c688b3b020b03a3354a38678 (diff) | |
download | prosody-5f98d0cc2359f1ab55b7af8179981592a3508faa.tar.gz prosody-5f98d0cc2359f1ab55b7af8179981592a3508faa.zip |
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.
Diffstat (limited to 'plugins/mod_pep.lua')
-rw-r--r-- | plugins/mod_pep.lua | 7 |
1 files changed, 7 insertions, 0 deletions
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 <items> 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 |