private boolean verifyJID(JID jid, Roster roster) {
        if (jid == null) {
            return false;
        }
        if (type == Type.jid) {
            if (jidValue.getResource() != null) {
                // Rule is filtering by exact resource match
                // (e.g. <user@domain/resource> or <domain/resource>)
                return jid.equals(jidValue);
            }
            else if (jidValue.getNode() != null) {
                // Rule is filtering by any resource matches (e.g. <user@domain>)
                return jid.toBareJID().equals(jidValue.toBareJID());
            }
            else {
                // Rule is filtering by domain (e.g. <domain>)
                return jid.getDomain().equals(jidValue.getDomain());
            }
        }
        else if (type == Type.group) {
            Collection<String> contactGroups;
            try {
                // Get the groups where the contact belongs
                RosterItem item = roster.getRosterItem(jid);
                contactGroups = item.getGroups();
            }
            catch (UserNotFoundException e) {
                // Sender is not in the user's roster
                contactGroups = Collections.emptyList();
            }
            // Check if the contact belongs to the specified group
            return contactGroups.contains(groupValue);
        }
        else {
            RosterItem.SubType contactSubscription = RosterItem.SUB_NONE;
            try {
                // Get the groups where the contact belongs
                RosterItem item = roster.getRosterItem(jid);
                contactSubscription = item.getSubStatus();
            }
            catch (UserNotFoundException e) {
                // Sender is not in the user's roster
            }
            // Check if the contact has the specified subscription status
            return contactSubscription == subscriptionValue;
        }
    }
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