private boolean matchesPacketTypeCondition(Packet packet, JID userJID) {
        if (filterEverything) {
            // This includes all type of packets (including subscription-related presences)
            return true;
        }
        Class<? extends Packet> packetClass = packet.getClass();
        if (Message.class.equals(packetClass)) {
            return filterMessage;
        }
        else if (Presence.class.equals(packetClass)) {
            Presence.Type presenceType = ((Presence) packet).getType();
            // Only filter presences of type available or unavailable
            // (ignore subscription-related presences)
            if (presenceType == null || presenceType == Presence.Type.unavailable) {
                // Calculate if packet is being received by the user
                JID to = packet.getTo();
                boolean incoming = to != null && to.toBareJID().equals(userJID.toBareJID());
                if (incoming) {
                    return filterPresence_in;
                }
                else {
                    return filterPresence_out;
                }
            }
        }
        else if (IQ.class.equals(packetClass)) {
            return filterIQ;
        }
        return false;
    }
Returns true if the packet to analyze matches the condition defined by this rule.
Variables involved in the analysis are: type (e.g. jid, group, etc.), value (based
on the type) and granular control that defines which type of packets should be
considered.

@param packet the packet to analyze if matches the rule's condition.
@param roster the roster of the owner of the privacy list.
@param userJID the JID of the owner of the privacy list.
@return true if the packet to analyze matches the condition defined by this rule.
xmppserver/src/main/java/org/jivesoftware/openfire/privacy/PrivacyItem.java