From 56523784e1824af2b149cdb65f756c5b6fd79866 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Fri, 26 Feb 2016 10:32:03 +0100 Subject: [PATCH] Implementation of pubsub#itemreply (EJAB-1347)(#928) --- src/mod_pubsub.erl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index 33016c46d..7fb0fa6db 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -3292,9 +3292,14 @@ broadcast_publish_item(Host, Node, Nidx, Type, NodeOptions, ItemId, From, Payloa true -> Payload; false -> [] end, + Attrs = case get_option(NodeOptions, itemreply, none) of + owner -> itemAttr(ItemId); %% owner not supported + publisher -> itemAttr(ItemId, {<<"publisher">>, jid:to_string(From)}); + none -> itemAttr(ItemId) + end, Stanza = event_stanza( [#xmlel{name = <<"items">>, attrs = nodeAttr(Node), - children = [#xmlel{name = <<"item">>, attrs = itemAttr(ItemId), + children = [#xmlel{name = <<"item">>, attrs = Attrs, children = Content}]}]), broadcast_stanza(Host, From, Node, Nidx, Type, NodeOptions, SubsByDepth, items, Stanza, true), @@ -3775,7 +3780,9 @@ get_configure_xfields(_Type, Options, Lang, Groups) -> ?BOOL_CONFIG_FIELD(<<"Only deliver notifications to available users">>, presence_based_delivery), ?NLIST_CONFIG_FIELD(<<"The collections with which a node is affiliated">>, - collection)]. + collection), + ?ALIST_CONFIG_FIELD(<<"Whether owners or publisher should receive replies to items">>, + itemreply, [none, owner, publisher])]. %%

There are several reasons why the node configuration request might fail:

%%