1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 07:42:06 +01:00

[offline] Make OfflineMessageManager.NAMESPACE public

This commit is contained in:
Florian Schmaus 2021-04-18 17:16:38 +02:00
parent 8c57d34b97
commit b0abfe1bba
2 changed files with 7 additions and 6 deletions

View file

@ -65,7 +65,7 @@ public final class OfflineMessageManager extends Manager {
private static final Logger LOGGER = Logger.getLogger(OfflineMessageManager.class.getName());
private static final String namespace = "http://jabber.org/protocol/offline";
public static final String NAMESPACE = "http://jabber.org/protocol/offline";
private static final Map<XMPPConnection, OfflineMessageManager> INSTANCES = new WeakHashMap<>();
@ -100,7 +100,7 @@ public final class OfflineMessageManager extends Manager {
* @throws InterruptedException if the calling thread was interrupted.
*/
public boolean supportsFlexibleRetrieval() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
return serviceDiscoveryManager.serverSupportsFeature(namespace);
return serviceDiscoveryManager.serverSupportsFeature(NAMESPACE);
}
/**
@ -114,8 +114,8 @@ public final class OfflineMessageManager extends Manager {
* @throws InterruptedException if the calling thread was interrupted.
*/
public int getMessageCount() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
DiscoverInfo info = serviceDiscoveryManager.discoverInfo(null, namespace);
DataForm dataForm = DataForm.from(info, namespace);
DiscoverInfo info = serviceDiscoveryManager.discoverInfo(null, NAMESPACE);
DataForm dataForm = DataForm.from(info, NAMESPACE);
if (dataForm == null) {
return 0;
}
@ -138,7 +138,7 @@ public final class OfflineMessageManager extends Manager {
*/
public List<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<OfflineMessageHeader> answer = new ArrayList<>();
DiscoverItems items = serviceDiscoveryManager.discoverItems(null, namespace);
DiscoverItems items = serviceDiscoveryManager.discoverItems(null, NAMESPACE);
for (DiscoverItems.Item item : items.getItems()) {
answer.add(new OfflineMessageHeader(item));
}

View file

@ -27,6 +27,7 @@ import org.jivesoftware.smack.packet.XmlEnvironment;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException;
import org.jivesoftware.smackx.offline.OfflineMessageManager;
/**
* Represents a request to get some or all the offline messages of a user. This class can also
@ -37,7 +38,7 @@ import org.jivesoftware.smack.xml.XmlPullParserException;
public class OfflineMessageRequest extends IQ {
public static final String ELEMENT = "offline";
public static final String NAMESPACE = "http://jabber.org/protocol/offline";
public static final String NAMESPACE = OfflineMessageManager.NAMESPACE;
private final List<Item> items = new ArrayList<>();
private boolean purge = false;