1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-01 18:52:08 +01:00

MessageEventManager's PacketFilter should ignore error type messages

Fixes SMACK-573
This commit is contained in:
Florian Schmaus 2014-06-10 18:56:50 +02:00
parent 92bf90d059
commit fe51a17324

View file

@ -30,6 +30,9 @@ import org.jivesoftware.smack.Manager;
import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.filter.NotFilter;
import org.jivesoftware.smack.filter.PacketExtensionFilter; import org.jivesoftware.smack.filter.PacketExtensionFilter;
import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
@ -51,8 +54,8 @@ public class MessageEventManager extends Manager {
private static final Map<XMPPConnection, MessageEventManager> INSTANCES = Collections private static final Map<XMPPConnection, MessageEventManager> INSTANCES = Collections
.synchronizedMap(new WeakHashMap<XMPPConnection, MessageEventManager>()); .synchronizedMap(new WeakHashMap<XMPPConnection, MessageEventManager>());
private static final PacketFilter PACKET_FILTER = new PacketExtensionFilter( private static final PacketFilter PACKET_FILTER = new AndFilter(new PacketExtensionFilter(
MessageEvent.ELEMENT, MessageEvent.NAMESPACE); new MessageEvent()), new NotFilter(MessageTypeFilter.ERROR));
private List<MessageEventNotificationListener> messageEventNotificationListeners = new CopyOnWriteArrayList<MessageEventNotificationListener>(); private List<MessageEventNotificationListener> messageEventNotificationListeners = new CopyOnWriteArrayList<MessageEventNotificationListener>();
private List<MessageEventRequestListener> messageEventRequestListeners = new CopyOnWriteArrayList<MessageEventRequestListener>(); private List<MessageEventRequestListener> messageEventRequestListeners = new CopyOnWriteArrayList<MessageEventRequestListener>();