mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-16 04:12:04 +01:00
Use new PacketExtensionFilter constructor
in OfflineMessageManager
This commit is contained in:
parent
1b2231be0b
commit
92bf90d059
1 changed files with 5 additions and 7 deletions
|
@ -58,15 +58,13 @@ public class OfflineMessageManager {
|
||||||
|
|
||||||
private final static String namespace = "http://jabber.org/protocol/offline";
|
private final static String namespace = "http://jabber.org/protocol/offline";
|
||||||
|
|
||||||
private XMPPConnection connection;
|
private final XMPPConnection connection;
|
||||||
|
|
||||||
private PacketFilter packetFilter;
|
private static final PacketFilter PACKET_FILTER = new AndFilter(new PacketExtensionFilter(
|
||||||
|
new OfflineMessageInfo()), new PacketTypeFilter(Message.class));;
|
||||||
|
|
||||||
public OfflineMessageManager(XMPPConnection connection) {
|
public OfflineMessageManager(XMPPConnection connection) {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
packetFilter =
|
|
||||||
new AndFilter(new PacketExtensionFilter("offline", namespace),
|
|
||||||
new PacketTypeFilter(Message.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,7 +146,7 @@ public class OfflineMessageManager {
|
||||||
request.addItem(item);
|
request.addItem(item);
|
||||||
}
|
}
|
||||||
// Filter offline messages that were requested by this request
|
// Filter offline messages that were requested by this request
|
||||||
PacketFilter messageFilter = new AndFilter(packetFilter, new PacketFilter() {
|
PacketFilter messageFilter = new AndFilter(PACKET_FILTER, new PacketFilter() {
|
||||||
public boolean accept(Packet packet) {
|
public boolean accept(Packet packet) {
|
||||||
OfflineMessageInfo info = (OfflineMessageInfo) packet.getExtension("offline",
|
OfflineMessageInfo info = (OfflineMessageInfo) packet.getExtension("offline",
|
||||||
namespace);
|
namespace);
|
||||||
|
@ -185,7 +183,7 @@ public class OfflineMessageManager {
|
||||||
request.setFetch(true);
|
request.setFetch(true);
|
||||||
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||||
|
|
||||||
PacketCollector messageCollector = connection.createPacketCollector(packetFilter);
|
PacketCollector messageCollector = connection.createPacketCollector(PACKET_FILTER);
|
||||||
// Collect the received offline messages
|
// Collect the received offline messages
|
||||||
Message message = (Message) messageCollector.nextResult();
|
Message message = (Message) messageCollector.nextResult();
|
||||||
while (message != null) {
|
while (message != null) {
|
||||||
|
|
Loading…
Reference in a new issue