powered by Jive Software

MamManager pageBefore problem

I have 30 messages in chat archive. Ids are 1, 2, 3, 4, 5, 6,…, 30.

mostRecentPage(chatJid, 5) calls pageBefore(chatJid, “”, 5) and everything is ok. I have 5 last messages from the archive. 30, 29, 28, 27, 26.

But when I call pageBefore(chatJid, 26, 5) I did not get 5 older conversation but nothing (number of messages from the archive is 0). Shall be something like:

pageBefore(chatJid, 26, 5) = 25, 24, 23, 21, 20

pageBefore(chatJid, 20, 5) = 19, 18, 17, 16, 15

But it’s not. I’m always getting 0 for the result list size:

List forwardedMessages = mamQueryResult.forwardedMessages;

forwardedMessages.size() = 0;

How can I navigate 5 by 5 messages backwards?

My mistake. Everything works just fine.

Instead of using message id we have to use mamFin first attribute value. So pageBefore(chatJid, FIRST, 5) works just fine.

The same result can be achieved using pagePrevious and previous mamQueryResult (pagePrevious(previousMamQueryResult, 5).