mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
parent
88d0b71d58
commit
5c931d7004
@ -738,8 +738,11 @@ get_items(Nidx, _From, undefined) ->
|
|||||||
|
|
||||||
get_items(Nidx, _From, #rsm_set{max = Max, index = IncIndex,
|
get_items(Nidx, _From, #rsm_set{max = Max, index = IncIndex,
|
||||||
'after' = After, before = Before}) ->
|
'after' = After, before = Before}) ->
|
||||||
RItems = lists:keysort(#pubsub_item.creation,
|
case lists:keysort(#pubsub_item.creation,
|
||||||
mnesia:index_read(pubsub_item, Nidx, #pubsub_item.nodeidx)),
|
mnesia:index_read(pubsub_item, Nidx, #pubsub_item.nodeidx)) of
|
||||||
|
[] ->
|
||||||
|
{result, {[], #rsm_set{count = 0}}};
|
||||||
|
RItems ->
|
||||||
Count = length(RItems),
|
Count = length(RItems),
|
||||||
Limit = case Max of
|
Limit = case Max of
|
||||||
undefined -> ?MAXITEMS;
|
undefined -> ?MAXITEMS;
|
||||||
@ -770,7 +773,8 @@ get_items(Nidx, _From, #rsm_set{max = Max, index = IncIndex,
|
|||||||
{0, lists:sublist(SubList, Limit)}
|
{0, lists:sublist(SubList, Limit)}
|
||||||
end,
|
end,
|
||||||
Rsm = rsm_page(Count, IncIndex, Offset, ItemsPage),
|
Rsm = rsm_page(Count, IncIndex, Offset, ItemsPage),
|
||||||
{result, {ItemsPage, Rsm}}.
|
{result, {ItemsPage, Rsm}}
|
||||||
|
end.
|
||||||
|
|
||||||
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, RSM) ->
|
get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, RSM) ->
|
||||||
SubKey = jid:tolower(JID),
|
SubKey = jid:tolower(JID),
|
||||||
@ -920,6 +924,8 @@ first_in_list(Pred, [H | T]) ->
|
|||||||
_ -> first_in_list(Pred, T)
|
_ -> first_in_list(Pred, T)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
rsm_page(Count, _, _, []) ->
|
||||||
|
#rsm_set{count = Count};
|
||||||
rsm_page(Count, Index, Offset, Items) ->
|
rsm_page(Count, Index, Offset, Items) ->
|
||||||
FirstItem = hd(Items),
|
FirstItem = hd(Items),
|
||||||
LastItem = lists:last(Items),
|
LastItem = lists:last(Items),
|
||||||
|
Loading…
Reference in New Issue
Block a user