aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-11-22 22:35:44 +0100
committerKim Alvefur <zash@zash.se>2023-11-22 22:35:44 +0100
commit37ba63f50be069885da0714267223f10535c55b8 (patch)
tree4646e51c120908441afab2a129b651bec895a0cb /plugins/mod_pubsub
parentb94a30ddcc0d0dad837aefab6f038d66dbb7bdb5 (diff)
downloadprosody-37ba63f50be069885da0714267223f10535c55b8.tar.gz
prosody-37ba63f50be069885da0714267223f10535c55b8.zip
mod_pubsub: Provide some node properties in summary template #1809
Gives some access to node details which are otherwise hard to determine if you only see the plain text summary, since it is shared based on the pubsub#type setting (or payload xmlns).
Diffstat (limited to 'plugins/mod_pubsub')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 1971f433..de09ec7d 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -139,12 +139,22 @@ end
-- Compose a textual representation of Atom payloads
local summary_templates = module:get_option("pubsub_summary_templates", {
- ["http://www.w3.org/2005/Atom"] = "{summary|or{{author/name|and{{author/name} posted }}{title}}}";
+ ["http://www.w3.org/2005/Atom"] = "{@pubsub:title|and{*{@pubsub:title}*\n\n}}{summary|or{{author/name|and{{author/name} posted }}{title}}}";
})
for pubsub_type, template in pairs(summary_templates) do
module:hook("pubsub-summary/"..pubsub_type, function (event)
local payload = event.payload;
+
+ local got_config, node_config = service:get_node_config(event.node, true);
+ if got_config then
+ payload = st.clone(payload);
+ payload.attr["xmlns:pubsub"] = xmlns_pubsub;
+ payload.attr["pubsub:node"] = event.node;
+ payload.attr["pubsub:title"] = node_config.title;
+ payload.attr["pubsub:description"] = node_config.description;
+ end
+
return xtemplate.render(template, payload, tostring);
end, -1);
end