24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-16 22:05:29 +02:00

Support for simple limiting the number of items in PubSub with RSM (#3618)

This fixes crash in Example 1 from "2.1 Limiting the Number of Items":
https://xmpp.org/extensions/xep-0059.html#limit
This commit is contained in:
Badlop 2021-06-08 16:42:38 +02:00
parent ccadbf45a2
commit 4520d5f3c1

View File

@ -750,6 +750,8 @@ get_items(Nidx, _From, #rsm_set{max = Max, index = IncIndex,
end,
{Offset, ItemsPage} =
case {IncIndex, Before, After} of
{undefined, undefined, undefined} ->
{0, lists:sublist(RItems, Limit)};
{I, undefined, undefined} ->
SubList = lists:nthtail(I, RItems),
{I, lists:sublist(SubList, Limit)};