/** * Lookup the archive's message ID of the latest message in the archive. Returns {@code null} if the archive is * empty. * * @return the ID of the lastest message or {@code null}. * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws NotLoggedInException * @throws InterruptedException * @since 4.3.0 */ public String getMessageUidOfLatestMessage() throws NoResponseException, XMPPErrorException, NotConnectedException, NotLoggedInException, InterruptedException { MamQueryArgs mamQueryArgs = MamQueryArgs.builder() .setResultPageSize(1) .queryLastPage() .build(); MamQuery mamQuery = queryArchive(mamQueryArgs); if (mamQuery.getMessages().isEmpty()) { return null; } return mamQuery.getMamResultExtensions().get(0).getId(); }
.setResultPageSizeTo(1) .limitResultsToJid(userOne) .queryLastPage() .build(); MamQuery mamQuery = mamManagerConTwo.queryArchive(mamQueryArgs);
/** * Lookup the archive's message ID of the latest message in the archive. Returns {@code null} if the archive is * empty. * * @return the ID of the lastest message or {@code null}. * @throws NoResponseException * @throws XMPPErrorException * @throws NotConnectedException * @throws NotLoggedInException * @throws InterruptedException * @since 4.3.0 */ public String getMessageUidOfLatestMessage() throws NoResponseException, XMPPErrorException, NotConnectedException, NotLoggedInException, InterruptedException { MamQueryArgs mamQueryArgs = MamQueryArgs.builder() .setResultPageSize(1) .queryLastPage() .build(); MamQuery mamQuery = queryArchive(mamQueryArgs); if (mamQuery.getMessages().isEmpty()) { return null; } return mamQuery.getMamResultExtensions().get(0).getId(); }
public MamQuery queryMostRecentPage(Jid jid, int max) throws NoResponseException, XMPPErrorException, NotConnectedException, NotLoggedInException, InterruptedException { MamQueryArgs mamQueryArgs = MamQueryArgs.builder() // Produces an empty <before/> element for XEP-0059 § 2.5 .queryLastPage() .limitResultsToJid(jid) .setResultPageSize(max) .build(); return queryArchive(mamQueryArgs); }
public MamQuery queryMostRecentPage(Jid jid, int max) throws NoResponseException, XMPPErrorException, NotConnectedException, NotLoggedInException, InterruptedException { MamQueryArgs mamQueryArgs = MamQueryArgs.builder() // Produces an empty <before/> element for XEP-0059 § 2.5 .queryLastPage() .limitResultsToJid(jid) .setResultPageSize(max) .build(); return queryArchive(mamQueryArgs); }