Software /
code /
prosody
Comparison
plugins/mod_pep.lua @ 12960:31b22cc221b5
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 22 Mar 2023 11:39:19 +0000 (21 months ago) |
parent | 12260:e729c994e7c7 |
child | 12962:1b179d14a1dd |
comparison
equal
deleted
inserted
replaced
12959:e331210beeb2 | 12960:31b22cc221b5 |
---|---|
134 end | 134 end |
135 | 135 |
136 local function get_broadcaster(username) | 136 local function get_broadcaster(username) |
137 local user_bare = jid_join(username, host); | 137 local user_bare = jid_join(username, host); |
138 local function simple_broadcast(kind, node, jids, item, _, node_obj) | 138 local function simple_broadcast(kind, node, jids, item, _, node_obj) |
139 local expose_publisher; | |
139 if node_obj then | 140 if node_obj then |
140 if node_obj.config["notify_"..kind] == false then | 141 if node_obj.config["notify_"..kind] == false then |
141 return; | 142 return; |
143 end | |
144 if node_obj.config.itemreply == "publisher" then | |
145 expose_publisher = true; | |
142 end | 146 end |
143 end | 147 end |
144 if kind == "retract" then | 148 if kind == "retract" then |
145 kind = "items"; -- XEP-0060 signals retraction in an <items> container | 149 kind = "items"; -- XEP-0060 signals retraction in an <items> container |
146 end | 150 end |
148 item = st.clone(item); | 152 item = st.clone(item); |
149 item.attr.xmlns = nil; -- Clear the pubsub namespace | 153 item.attr.xmlns = nil; -- Clear the pubsub namespace |
150 if kind == "items" then | 154 if kind == "items" then |
151 if node_obj and node_obj.config.include_payload == false then | 155 if node_obj and node_obj.config.include_payload == false then |
152 item:maptags(function () return nil; end); | 156 item:maptags(function () return nil; end); |
157 end | |
158 if not expose_publisher then | |
159 item.attr.publisher = nil; | |
153 end | 160 end |
154 end | 161 end |
155 end | 162 end |
156 | 163 |
157 local id = new_id(); | 164 local id = new_id(); |