1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

Remove deprecated methods in MamManager

This commit is contained in:
Florian Schmaus 2018-06-14 10:00:24 +02:00
parent 8841c4aed2
commit 9f786fc70d

View file

@ -445,191 +445,6 @@ public final class MamManager extends Manager {
} }
} }
/**
* Query archive with a maximum amount of results.
*
* @param max
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchive(Integer max) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
return queryArchive(null, max, null, null, null, null);
}
/**
* Query archive with a JID (only messages from/to the JID).
*
* @param withJid
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchive(Jid withJid) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
return queryArchive(null, null, null, null, withJid, null);
}
/**
* Query archive filtering by start and/or end date. If start == null, the
* value of 'start' will be equal to the date/time of the earliest message
* stored in the archive. If end == null, the value of 'end' will be equal
* to the date/time of the most recent message stored in the archive.
*
* @param start
* @param end
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchive(Date start, Date end) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
return queryArchive(null, null, start, end, null, null);
}
/**
* Query Archive adding filters with additional fields.
*
* @param additionalFields
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchive(List<FormField> additionalFields) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
return queryArchive(null, null, null, null, null, additionalFields);
}
/**
* Query archive filtering by start date. The value of 'end' will be equal
* to the date/time of the most recent message stored in the archive.
*
* @param start
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchiveWithStartDate(Date start) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
return queryArchive(null, null, start, null, null, null);
}
/**
* Query archive filtering by end date. The value of 'start' will be equal
* to the date/time of the earliest message stored in the archive.
*
* @param end
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchiveWithEndDate(Date end) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
return queryArchive(null, null, null, end, null, null);
}
/**
* Query archive applying filters: max count, start date, end date, from/to
* JID and with additional fields.
*
* @param max
* @param start
* @param end
* @param withJid
* @param additionalFields
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchive(Integer max, Date start, Date end, Jid withJid, List<FormField> additionalFields)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException,
NotLoggedInException {
return queryArchive(null, max, start, end, withJid, additionalFields);
}
/**
* Query an message archive like a MUC archive or a PubSub node archive, addressed by an archiveAddress, applying
* filters: max count, start date, end date, from/to JID and with additional fields. When archiveAddress is null the
* default, the server will be requested.
*
* @param node The PubSub node name, can be null
* @param max
* @param start
* @param end
* @param withJid
* @param additionalFields
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult queryArchive(String node, Integer max, Date start, Date end, Jid withJid,
List<FormField> additionalFields)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException,
NotLoggedInException {
MamQueryArgs mamQueryArgs = MamQueryArgs.builder()
.queryNode(node)
.setResultPageSize(max)
.limitResultsSince(start)
.limitResultsBefore(end)
.limitResultsToJid(withJid)
.withAdditionalFormFields(additionalFields)
.build();
MamQuery mamQuery = queryArchive(mamQueryArgs);
return new MamQueryResult(mamQuery);
}
public MamQuery queryArchive(MamQueryArgs mamQueryArgs) throws NoResponseException, XMPPErrorException, public MamQuery queryArchive(MamQueryArgs mamQueryArgs) throws NoResponseException, XMPPErrorException,
NotConnectedException, NotLoggedInException, InterruptedException { NotConnectedException, NotLoggedInException, InterruptedException {
String queryId = UUID.randomUUID().toString(); String queryId = UUID.randomUUID().toString();
@ -659,183 +474,6 @@ public final class MamManager extends Manager {
dataForm.addField(formField); dataForm.addField(formField);
} }
/**
* Returns a page of the archive.
*
* @param dataForm
* @param rsmSet
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult page(DataForm dataForm, RSMSet rsmSet) throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
return page(null, dataForm, rsmSet);
}
/**
* Returns a page of the archive. This is a low-level method, you possibly do not want to use it directly unless you
* know what you are doing.
*
* @param node The PubSub node name, can be null
* @param dataForm
* @param rsmSet
* @return the MAM query result
* @throws NoResponseException
* @throws XMPPErrorException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NotLoggedInException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult page(String node, DataForm dataForm, RSMSet rsmSet)
throws NoResponseException, XMPPErrorException,
NotConnectedException, InterruptedException, NotLoggedInException {
MamQueryIQ mamQueryIQ = new MamQueryIQ(UUID.randomUUID().toString(), node, dataForm);
mamQueryIQ.setType(IQ.Type.set);
mamQueryIQ.setTo(archiveAddress);
mamQueryIQ.addExtension(rsmSet);
MamQuery mamQuery = queryArchive(mamQueryIQ);
return new MamQueryResult(mamQuery);
}
/**
* Returns the next 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
* @deprecated use {@link MamQuery#pageNext(int)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult pageNext(MamQueryResult mamQueryResult, int count) throws NoResponseException,
XMPPErrorException, NotConnectedException, InterruptedException, NotLoggedInException {
RSMSet previousResultRsmSet = mamQueryResult.mamFin.getRSMSet();
RSMSet requestRsmSet = new RSMSet(count, previousResultRsmSet.getLast(), RSMSet.PageDirection.after);
return page(mamQueryResult, 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
* @deprecated use {@link MamQuery#pagePrevious(int)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
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, requestRsmSet);
}
private MamQueryResult page(MamQueryResult mamQueryResult, RSMSet requestRsmSet) throws NoResponseException,
XMPPErrorException, NotConnectedException, NotLoggedInException, InterruptedException {
ensureMamQueryResultMatchesThisManager(mamQueryResult);
return page(mamQueryResult.node, mamQueryResult.form, requestRsmSet);
}
/**
* Obtain page before the first message saved (specific chat).
* <p>
* Note that the messageUid is the XEP-0313 UID and <b>not</b> the stanza ID of the message.
* </p>
*
* @param chatJid
* @param messageUid the UID of the message of which messages before should be received.
* @param max
* @return the MAM query result
* @throws XMPPErrorException
* @throws NotLoggedInException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NoResponseException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult pageBefore(Jid chatJid, String messageUid, int max) throws XMPPErrorException,
NotLoggedInException, NotConnectedException, InterruptedException, NoResponseException {
RSMSet rsmSet = new RSMSet(null, messageUid, -1, -1, null, max, null, -1);
DataForm dataForm = getNewMamForm();
addWithJid(chatJid, dataForm);
return page(null, dataForm, rsmSet);
}
/**
* Obtain page after the last message saved (specific chat).
* <p>
* Note that the messageUid is the XEP-0313 UID and <b>not</b> the stanza ID of the message.
* </p>
*
* @param chatJid
* @param messageUid the UID of the message of which messages after should be received.
* @param max
* @return the MAM query result
* @throws XMPPErrorException
* @throws NotLoggedInException
* @throws NotConnectedException
* @throws InterruptedException
* @throws NoResponseException
* @deprecated use {@link #queryArchive(MamQueryArgs)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult pageAfter(Jid chatJid, String messageUid, int max) throws XMPPErrorException,
NotLoggedInException, NotConnectedException, InterruptedException, NoResponseException {
RSMSet rsmSet = new RSMSet(messageUid, null, -1, -1, null, max, null, -1);
DataForm dataForm = getNewMamForm();
addWithJid(chatJid, dataForm);
return page(null, 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
* @deprecated use {@link #queryMostRecentPage(Jid, int)} instead.
*/
@Deprecated
// TODO Remove in Smack 4.4
public MamQueryResult mostRecentPage(Jid chatJid, int max) throws XMPPErrorException, NotLoggedInException,
NotConnectedException, InterruptedException, NoResponseException {
return pageBefore(chatJid, "", max);
}
public MamQuery queryMostRecentPage(Jid jid, int max) throws NoResponseException, XMPPErrorException, public MamQuery queryMostRecentPage(Jid jid, int max) throws NoResponseException, XMPPErrorException,
NotConnectedException, NotLoggedInException, InterruptedException { NotConnectedException, NotLoggedInException, InterruptedException {
MamQueryArgs mamQueryArgs = MamQueryArgs.builder() MamQueryArgs mamQueryArgs = MamQueryArgs.builder()