mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Add MAM methods to load previous page and to load most recent page
This commit is contained in:
parent
6f66b31fb7
commit
f7fcff139c
1 changed files with 38 additions and 0 deletions
|
@ -318,6 +318,27 @@ public final class MamManager extends Manager {
|
|||
return page(mamQueryResult.form, requestRsmSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the previous page of the archive.
|
||||
*
|
||||
* @param mamQueryResult
|
||||
* is the previous query result
|
||||
* @param count
|
||||
* is the amount of messages that a page contains
|
||||
* @return the MAM query result
|
||||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotLoggedInException
|
||||
*/
|
||||
public MamQueryResult pagePrevious(MamQueryResult mamQueryResult, int count) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException, InterruptedException, NotLoggedInException {
|
||||
RSMSet previousResultRsmSet = mamQueryResult.mamFin.getRSMSet();
|
||||
RSMSet requestRsmSet = new RSMSet(count, previousResultRsmSet.getFirst(), RSMSet.PageDirection.before);
|
||||
return page(mamQueryResult.form, requestRsmSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain page before the first message saved (specific chat).
|
||||
*
|
||||
|
@ -360,6 +381,23 @@ public final class MamManager extends Manager {
|
|||
return page(dataForm, rsmSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the most recent page of a chat.
|
||||
*
|
||||
* @param chatJid
|
||||
* @param max
|
||||
* @return the MAM query result
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotLoggedInException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NoResponseException
|
||||
*/
|
||||
public MamQueryResult mostRecentPage(Jid chatJid, int max) throws XMPPErrorException, NotLoggedInException,
|
||||
NotConnectedException, InterruptedException, NoResponseException {
|
||||
return pageBefore(chatJid, "", max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the form fields supported by the server.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue