class InSpammerBlacklist extends GenericMatcher {

    @Override
    public Collection<MailAddress> match(Mail mail) {
        String host = mail.getRemoteAddr();
        try {
            // Have to reverse the octets first
            StringBuilder sb = new StringBuilder();
            StringTokenizer st = new StringTokenizer(host, " .", false);

            while (st.hasMoreTokens()) {
                sb.insert(0, st.nextToken() + ".");
            }

            // Add the network prefix for this blacklist
            sb.append(network);

            // Try to look it up
            dnsServer.getByName(sb.toString());

            // If we got here, that's bad... it means the host
            // was found in the blacklist
            return mail.getRecipients();
        } catch (UnknownHostException uhe) {
            // This is good... it's not on the list
            return null;
        }
    }

}