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

Use new PacketExtensionFilter constructor

in OfflineMessageManager
This commit is contained in:
Florian Schmaus 2014-06-10 18:54:53 +02:00
parent 1b2231be0b
commit 92bf90d059

View file

@ -58,15 +58,13 @@ public class OfflineMessageManager {
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) {
this.connection = connection;
packetFilter =
new AndFilter(new PacketExtensionFilter("offline", namespace),
new PacketTypeFilter(Message.class));
}
/**
@ -148,7 +146,7 @@ public class OfflineMessageManager {
request.addItem(item);
}
// 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) {
OfflineMessageInfo info = (OfflineMessageInfo) packet.getExtension("offline",
namespace);
@ -185,7 +183,7 @@ public class OfflineMessageManager {
request.setFetch(true);
connection.createPacketCollectorAndSend(request).nextResultOrThrow();
PacketCollector messageCollector = connection.createPacketCollector(packetFilter);
PacketCollector messageCollector = connection.createPacketCollector(PACKET_FILTER);
// Collect the received offline messages
Message message = (Message) messageCollector.nextResult();
while (message != null) {