summaryrefslogtreecommitdiff
path: root/src/mod_pubsub.erl
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2015-12-16 17:04:45 +0100
committerChristophe Romain <christophe.romain@process-one.net>2015-12-16 17:04:45 +0100
commit6957e892dde33511101e8f6012b774e4ffee7ae0 (patch)
tree14f919b189962f4e8fc52a0ff0cfc4db037f6064 /src/mod_pubsub.erl
parentUse correct notification_type for last items (#827) (diff)
Fix last item message type as message attribute
Diffstat (limited to 'src/mod_pubsub.erl')
-rw-r--r--src/mod_pubsub.erl13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl
index 690422c3..9c334ebc 100644
--- a/src/mod_pubsub.erl
+++ b/src/mod_pubsub.erl
@@ -3254,7 +3254,6 @@ payload_xmlelements([_ | Tail], Count) ->
payload_xmlelements(Tail, Count).
items_event_stanza(Node, Options, Items) ->
- NotificationType = get_option(Options, notification_type, headline),
MoreEls = case Items of
[LastItem] ->
{ModifNow, ModifUSR} = LastItem#pubsub_item.modification,
@@ -3267,14 +3266,12 @@ items_event_stanza(Node, Options, Items) ->
_ ->
[]
end,
- event_stanza_with_els([#xmlel{name = <<"items">>,
- attrs = case NotificationType of
- normal -> nodeAttr(Node);
- _ -> [{<<"type">>, jlib:atom_to_binary(NotificationType)}
- | nodeAttr(Node)]
- end,
+ BaseStanza = event_stanza_with_els([#xmlel{name = <<"items">>,
+ attrs = nodeAttr(Node),
children = itemsEls(Items)}],
- MoreEls).
+ MoreEls),
+ NotificationType = get_option(Options, notification_type, headline),
+ add_message_type(BaseStanza, NotificationType).
event_stanza(Els) ->
event_stanza_with_els(Els, []).