aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/mod_pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-07-14 19:34:10 +0200
committerKim Alvefur <zash@zash.se>2018-07-14 19:34:10 +0200
commit97644a718986fc2c8b7377f10a30f9b260cde255 (patch)
treef424c4eeb1f4f6cb9ee0230d9d7f468f3d425321 /plugins/mod_pubsub/mod_pubsub.lua
parent47eca5d3fb991ba505df36147f31c7f23643fa79 (diff)
downloadprosody-97644a718986fc2c8b7377f10a30f9b260cde255.tar.gz
prosody-97644a718986fc2c8b7377f10a30f9b260cde255.zip
mod_pubsub: Move include_body option into subscription options
Diffstat (limited to 'plugins/mod_pubsub/mod_pubsub.lua')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index c97e9d98..829846c4 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -51,13 +51,14 @@ function simple_broadcast(kind, node, jids, item, actor, node_obj)
message:add_child(item);
end
+ local summary;
-- Compose a sensible textual representation of at least Atom payloads
- if node_obj and item and node_obj.config.include_body and item.tags[1] then
+ if item and item.tags[1] then
local payload = item.tags[1];
if payload.attr.xmlns == "http://www.w3.org/2005/Atom" then
message:reset();
local title = payload:get_child_text("title");
- local summary = payload:get_child_text("summary");
+ summary = payload:get_child_text("summary");
if not summary and title then
local author = payload:find("author/name#");
summary = title;
@@ -65,13 +66,17 @@ function simple_broadcast(kind, node, jids, item, actor, node_obj)
summary = author .. " posted " .. summary;
end
end
- if summary then
- message:body(summary);
- end
end
end
- module:broadcast(jids, message, pairs);
+ for jid, options in pairs(jids) do
+ local new_stanza = st.clone(message);
+ if type(options) == "table" and options["pubsub#include_body"] then
+ new_stanza:body(summary);
+ end
+ new_stanza.attr.to = jid;
+ module:send(new_stanza);
+ end
end
function is_item_stanza(item)