Class IQReplyFilter
- java.lang.Object
-
- org.jivesoftware.smack.filter.IQReplyFilter
-
- All Implemented Interfaces:
StanzaFilter
,Predicate<Stanza>
- Direct Known Subclasses:
IQResultReplyFilter
public class IQReplyFilter extends java.lang.Object implements StanzaFilter
Filters for packets which are a valid reply to an IQ request.Such a stanza must have the same stanza id and must be an IQ stanza of type
RESULT
orERROR
. Moreover, it is necessary to check thefrom
address to ignore forged replies.We accept a
from
address if one of the following is true:- It matches the
to
address of the request. - The
to
address of the request was empty and thefrom
address matches either the bare jid of the server or the (bare or full jid) of the client. - To
to
was our bare address and thefrom
is empty.
For a discussion of the issues, see the thread "Spoofing of iq ids and misbehaving servers" from 2014-01 on the jdev@jabber.org mailing list and following discussion in February and March.
-
-
Constructor Summary
Constructors Constructor Description IQReplyFilter(IQ iqPacket, XMPPConnection conn)
Filters for packets which are a valid reply to an IQ request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(Stanza packet)
Tests whether or not the specified stanza should pass the filter.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.filter.StanzaFilter
asPredicate, test
-
-
-
-
Constructor Detail
-
IQReplyFilter
public IQReplyFilter(IQ iqPacket, XMPPConnection conn)
Filters for packets which are a valid reply to an IQ request.Such a stanza must have the same stanza id and must be an IQ stanza of type
RESULT
orERROR
. Moreover, it is necessary to check thefrom
address to ignore forged replies.We accept a
from
address if one of the following is true:- It matches the
to
address of the request. - The
to
address of the request was empty and thefrom
address matches either the bare jid of the server or the (bare or full jid) of the client. - To
to
was our bare address and thefrom
is empty.
For a discussion of the issues, see the thread "Spoofing of iq ids and misbehaving servers" from 2014-01 on the jdev@jabber.org mailing list and following discussion in February and March.
- Parameters:
iqPacket
- An IQ request. Filter for replies to this packet.conn
- connection.
- It matches the
-
-
Method Detail
-
accept
public boolean accept(Stanza packet)
Description copied from interface:StanzaFilter
Tests whether or not the specified stanza should pass the filter.- Specified by:
accept
in interfaceStanzaFilter
- Parameters:
packet
- the stanza to test.- Returns:
- true if and only if
stanza
passes the filter.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-