1
0
Fork 0
mirror of https://github.com/processone/ejabberd synced 2025-10-03 09:49:18 +02:00

Pubsub: implment '6.5.7 Requesting the Most Recent Items'

This commit is contained in:
Christophe Romain 2017-09-27 20:54:50 +02:00
parent ce7acafe37
commit 126653e01b

View file

@ -1959,15 +1959,11 @@ purge_node(Host, Node, Owner) ->
-spec get_items(host(), binary(), jid(), binary(), -spec get_items(host(), binary(), jid(), binary(),
binary(), [binary()], undefined | rsm_set()) -> binary(), [binary()], undefined | rsm_set()) ->
{result, pubsub()} | {error, stanza_error()}. {result, pubsub()} | {error, stanza_error()}.
get_items(Host, Node, From, SubId, SMaxItems, ItemIds, RSM) -> get_items(Host, Node, From, SubId, MaxItems, ItemIds, undefined)
MaxItems = if SMaxItems == undefined -> when MaxItems =/= undefined ->
case get_max_items_node(Host) of get_items(Host, Node, From, SubId, MaxItems, ItemIds,
undefined -> ?MAXITEMS; #rsm_set{max = MaxItems, before = <<>>});
Max -> Max get_items(Host, Node, From, SubId, _MaxItems, ItemIds, RSM) ->
end;
true ->
SMaxItems
end,
Action = Action =
fun(#pubsub_node{options = Options, type = Type, fun(#pubsub_node{options = Options, type = Type,
id = Nidx, owners = O}) -> id = Nidx, owners = O}) ->
@ -2009,7 +2005,7 @@ get_items(Host, Node, From, SubId, SMaxItems, ItemIds, RSM) ->
end, end,
{result, {result,
#pubsub{items = #ps_items{node = Node, #pubsub{items = #ps_items{node = Node,
items = itemsEls(lists:sublist(SendItems, MaxItems))}, items = itemsEls(SendItems)},
rsm = RsmOut}}; rsm = RsmOut}};
{result, {_, Item}} -> {result, {_, Item}} ->
{result, {result,