Class IQReplyFilter

  • All Implemented Interfaces:
    StanzaFilter, Predicate<Stanza>
    Direct Known Subclasses:
    IQResultReplyFilter

    public class IQReplyFilter
    extends 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 or ERROR. Moreover, it is necessary to check the from 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 the from 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 the from 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 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 or ERROR. Moreover, it is necessary to check the from 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 the from 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 the from 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.
    • 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 interface StanzaFilter
        Parameters:
        packet - the stanza to test.
        Returns:
        true if and only if stanza passes the filter.