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

Make EventContentFilter use FlexiableStanzaTypeFilter<Message>

This commit is contained in:
Florian Schmaus 2015-12-06 22:48:22 +01:00
parent db72917bb4
commit 54ba300dc5

View file

@ -25,8 +25,8 @@ import org.jivesoftware.smack.StanzaListener;
import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter;
import org.jivesoftware.smack.filter.OrFilter; import org.jivesoftware.smack.filter.OrFilter;
import org.jivesoftware.smack.filter.StanzaFilter;
import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.ExtensionElement;
@ -697,7 +697,7 @@ abstract public class Node
* *
* @author Robin Collier * @author Robin Collier
*/ */
class EventContentFilter implements StanzaFilter class EventContentFilter extends FlexibleStanzaTypeFilter<Message>
{ {
private String firstElement; private String firstElement;
private String secondElement; private String secondElement;
@ -713,12 +713,8 @@ abstract public class Node
secondElement = secondLevelElement; secondElement = secondLevelElement;
} }
public boolean accept(Stanza packet) public boolean acceptSpecific(Message message) {
{ EventElement event = EventElement.from(message);
if (!(packet instanceof Message))
return false;
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
if (event == null) if (event == null)
return false; return false;