aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/mod_pubsub.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/mod_pubsub.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/mod_pubsub.lua')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 80b1dbae..74995a2b 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -41,7 +41,7 @@ else
end
-function simple_broadcast(kind, node, jids, item, actor)
+function simple_broadcast(kind, node, jids, item, actor, node_obj)
if item then
item = st.clone(item);
item.attr.xmlns = nil; -- Clear the pubsub namespace
@@ -51,10 +51,12 @@ function simple_broadcast(kind, node, jids, item, actor)
end
local id = new_id();
- local message = st.message({ from = module.host, type = "headline", id = id })
+ local msg_type = node_obj and node_obj.config.message_type or "headline";
+ local message = st.message({ from = module.host, type = msg_type, id = id })
:tag("event", { xmlns = xmlns_pubsub_event })
:tag(kind, { node = node })
:add_child(item);
+
module:broadcast(jids, message, pairs);
end