aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-05-21 00:35:45 +0200
committerKim Alvefur <zash@zash.se>2018-05-21 00:35:45 +0200
commitb993873f730e543de912343090211cb6cb52424b (patch)
treea18ad8c87a987cfc8b91e724931d74cdc3f62e5a /plugins/mod_pubsub/pubsub.lib.lua
parent994723d8867acc331a5d1438576be795cf361140 (diff)
downloadprosody-b993873f730e543de912343090211cb6cb52424b.tar.gz
prosody-b993873f730e543de912343090211cb6cb52424b.zip
mod_pubsub: Make the 'type' attribute on broadcast messages configurable
This adds support for the pubsub#notification_type field in the node config form.
Diffstat (limited to 'plugins/mod_pubsub/pubsub.lib.lua')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 8890392e..423abd86 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -52,6 +52,14 @@ local node_config_form = dataform {
name = "pubsub#persist_items";
label = "Persist items to storage";
};
+ {
+ type = "list-single";
+ name = "pubsub#notification_type";
+ label = "Specify the delivery style for notifications";
+ options = {
+ { label = "Messages of type normal", value = "normal" },
+ { label = "Messages of type headline", value = "headline", default = true },
+ };
};
local service_method_feature_map = {
@@ -187,6 +195,7 @@ function handlers.set_create(origin, stanza, create, service)
config = {
["max_items"] = tonumber(form_data["pubsub#max_items"]);
["persist_items"] = form_data["pubsub#persist_items"];
+ ["notification_type"] = form_data["pubsub#notification_type"];
};
end
if node then
@@ -373,7 +382,8 @@ function handlers.owner_get_configure(origin, stanza, config, service)
local node_config = node_obj.config;
local pubsub_form_data = {
["pubsub#max_items"] = tostring(node_config["max_items"]);
- ["pubsub#persist_items"] = node_config["persist_items"]
+ ["pubsub#persist_items"] = node_config["persist_items"];
+ ["pubsub#notification_type"] = node_config["notification_type"];
}
local reply = st.reply(stanza)
:tag("pubsub", { xmlns = xmlns_pubsub_owner })