summaryrefslogtreecommitdiff
path: root/src/mod_pubsub.erl
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2017-09-27 20:54:50 +0200
committerChristophe Romain <christophe.romain@process-one.net>2017-09-27 20:54:50 +0200
commit126653e01b2651ee422229cd2bc46439a8fcf98a (patch)
treeda867369a9102cde4243ab36521fe50ff040f601 /src/mod_pubsub.erl
parentRemove useless condition (diff)
Pubsub: implment '6.5.7 Requesting the Most Recent Items'
Diffstat (limited to 'src/mod_pubsub.erl')
-rw-r--r--src/mod_pubsub.erl16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl
index 669422d1..0f344cc1 100644
--- a/src/mod_pubsub.erl
+++ b/src/mod_pubsub.erl
@@ -1959,15 +1959,11 @@ purge_node(Host, Node, Owner) ->
-spec get_items(host(), binary(), jid(), binary(),
binary(), [binary()], undefined | rsm_set()) ->
{result, pubsub()} | {error, stanza_error()}.
-get_items(Host, Node, From, SubId, SMaxItems, ItemIds, RSM) ->
- MaxItems = if SMaxItems == undefined ->
- case get_max_items_node(Host) of
- undefined -> ?MAXITEMS;
- Max -> Max
- end;
- true ->
- SMaxItems
- end,
+get_items(Host, Node, From, SubId, MaxItems, ItemIds, undefined)
+ when MaxItems =/= undefined ->
+ get_items(Host, Node, From, SubId, MaxItems, ItemIds,
+ #rsm_set{max = MaxItems, before = <<>>});
+get_items(Host, Node, From, SubId, _MaxItems, ItemIds, RSM) ->
Action =
fun(#pubsub_node{options = Options, type = Type,
id = Nidx, owners = O}) ->
@@ -2009,7 +2005,7 @@ get_items(Host, Node, From, SubId, SMaxItems, ItemIds, RSM) ->
end,
{result,
#pubsub{items = #ps_items{node = Node,
- items = itemsEls(lists:sublist(SendItems, MaxItems))},
+ items = itemsEls(SendItems)},
rsm = RsmOut}};
{result, {_, Item}} ->
{result,