aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-08-16 15:20:29 +0200
committerKim Alvefur <zash@zash.se>2018-08-16 15:20:29 +0200
commit533cefaaf10bed012cbfb1f92cc9a7a5235bfec0 (patch)
tree301b63d70466205417044d733d3d916c7d817968 /plugins
parent8d3bfff0c2c158ec5d0e22a1d1be08acb58e49e2 (diff)
downloadprosody-533cefaaf10bed012cbfb1f92cc9a7a5235bfec0.tar.gz
prosody-533cefaaf10bed012cbfb1f92cc9a7a5235bfec0.zip
mod_pubsub: Add support for thin notifications (without the full payload)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua3
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua7
2 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 01bf3aea..4e9cecb4 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -60,6 +60,9 @@ function simple_broadcast(kind, node, jids, item, actor, node_obj)
item = st.clone(item);
item.attr.xmlns = nil; -- Clear the pubsub namespace
if kind == "items" then
+ if node_obj and node_obj.config.include_payload == false then
+ item:maptags(function () return nil; end);
+ end
if expose_publisher and actor then
item.attr.publisher = actor
end
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 1850c54c..5c3b1e89 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -104,6 +104,11 @@ local node_config_form = dataform {
name = "pubsub#deliver_notifications";
};
{
+ type = "boolean";
+ label = "Whether to deliver payloads with event notifications";
+ name = "pubsub#deliver_payloads";
+ };
+ {
type = "list-single";
name = "pubsub#notification_type";
label = "Specify the delivery style for notifications";
@@ -171,6 +176,7 @@ local config_field_map = {
notify_items = "pubsub#deliver_notifications";
notify_delete = "pubsub#notify_delete";
notify_retract = "pubsub#notify_retract";
+ include_payload = "pubsub#deliver_payloads";
};
local reverse_config_field_map = {};
for k, v in pairs(config_field_map) do reverse_config_field_map[v] = k; end
@@ -189,6 +195,7 @@ local function config_to_xep0060(node_config)
["pubsub#deliver_notifications"] = node_config["notify_items"];
["pubsub#notify_delete"] = node_config["notify_delete"];
["pubsub#notify_retract"] = node_config["notify_retract"];
+ ["pubsub#deliver_payloads"] = node_config["include_payload"]
}
end