25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Merge branch 'master' of github.com:processone/ejabberd

This commit is contained in:
Evgeniy Khramtsov 2017-12-28 14:01:39 +03:00
commit e03d41647b
2 changed files with 2 additions and 16 deletions

View File

@ -734,14 +734,7 @@ del_state(#pubsub_state{stateid = {Key, Nidx}, items = Items}) ->
get_items(Nidx, _From, undefined) -> get_items(Nidx, _From, undefined) ->
RItems = lists:keysort(#pubsub_item.creation, RItems = lists:keysort(#pubsub_item.creation,
mnesia:index_read(pubsub_item, Nidx, #pubsub_item.nodeidx)), mnesia:index_read(pubsub_item, Nidx, #pubsub_item.nodeidx)),
Count = length(RItems), {result, {RItems, undefined}};
if Count =< ?MAXITEMS ->
{result, {RItems, undefined}};
true ->
ItemsPage = lists:sublist(RItems, ?MAXITEMS),
Rsm = rsm_page(Count, 0, 0, ItemsPage),
{result, {ItemsPage, Rsm}}
end;
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}) ->

View File

@ -655,14 +655,7 @@ get_items(Nidx, _From, undefined) ->
" from pubsub_item where nodeid='", SNidx/binary, "'", " from pubsub_item where nodeid='", SNidx/binary, "'",
" order by creation asc">>]) of " order by creation asc">>]) of
{selected, _, AllItems} -> {selected, _, AllItems} ->
Count = length(AllItems), {result, {[raw_to_item(Nidx, RItem) || RItem <- AllItems], undefined}};
if Count =< ?MAXITEMS ->
{result, {[raw_to_item(Nidx, RItem) || RItem <- AllItems], undefined}};
true ->
RItems = lists:sublist(AllItems, ?MAXITEMS),
Rsm = rsm_page(Count, 0, 0, RItems),
{result, {[raw_to_item(Nidx, RItem) || RItem <- RItems], Rsm}}
end;
_ -> _ ->
{result, {[], undefined}} {result, {[], undefined}}
end; end;