/** * The match method. * * @param msg the pattern match is applied to this Message's * subject header * @return true if the pattern match succeeds, otherwise false */ public boolean match(Message msg) { String subj; try { subj = msg.getSubject(); } catch (Exception e) { return false; } if (subj == null) return false; return super.match(subj); }
/** * Equality comparison. */ public boolean equals(Object obj) { if (!(obj instanceof MessageIDTerm)) return false; return super.equals(obj); } }
/** * Compute a hashCode for this object. */ public int hashCode() { // XXX - depends on header comparisons being case independent return headerName.toLowerCase(Locale.ENGLISH).hashCode() + super.hashCode(); } }
/** * Check if the "text" terms in the given SearchTerm contain * non US-ASCII characters. * * @param term the search term * @return true if only ASCII */ public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm) return isAscii(((AndTerm)term).getTerms()); else if (term instanceof OrTerm) return isAscii(((OrTerm)term).getTerms()); else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * Check if the "text" terms in the given SearchTerm contain * non US-ASCII characters. * * @param term the search term * @return true if only ASCII */ public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm) return isAscii(((AndTerm)term).getTerms()); else if (term instanceof OrTerm) return isAscii(((OrTerm)term).getTerms()); else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * The header match method. * * @param msg The match is applied to this Message's header * @return true if the match succeeds, otherwise false */ public boolean match(Message msg) { String[] headers; try { headers = msg.getHeader(headerName); } catch (Exception e) { return false; } if (headers == null) return false; for (int i=0; i < headers.length; i++) if (super.match(headers[i])) return true; return false; }
/** * Equality comparison. */ public boolean equals(Object obj) { if (!(obj instanceof BodyTerm)) return false; return super.equals(obj); } }
/** * Compute a hashCode for this object. */ @Override public int hashCode() { // XXX - depends on header comparisons being case independent return headerName.toLowerCase(Locale.ENGLISH).hashCode() + super.hashCode(); } }
public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm || term instanceof OrTerm) { SearchTerm[] terms; if (term instanceof AndTerm) terms = ((AndTerm)term).getTerms(); else terms = ((OrTerm)term).getTerms(); for (int i = 0; i < terms.length; i++) if (!isAscii(terms[i])) // outta here ! return false; } else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * The match method. * * @param msg the match is applied to this Message's * Message-ID header * @return true if the match succeeds, otherwise false */ public boolean match(Message msg) { String[] s; try { s = msg.getHeader("Message-ID"); } catch (Exception e) { return false; } if (s == null) return false; for (int i=0; i < s.length; i++) if (super.match(s[i])) return true; return false; }
/** * Equality comparison. */ public boolean equals(Object obj) { if (!(obj instanceof AddressStringTerm)) return false; return super.equals(obj); } }
/** * Compute a hashCode for this object. */ public int hashCode() { // XXX - depends on header comparisons being case independent return headerName.toLowerCase(Locale.ENGLISH).hashCode() + super.hashCode(); } }
static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm || term instanceof OrTerm) { SearchTerm[] terms; if (term instanceof AndTerm) terms = ((AndTerm)term).getTerms(); else terms = ((OrTerm)term).getTerms(); for (int i = 0; i < terms.length; i++) if (!isAscii(terms[i])) // outta here ! return false; } else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * The match method. * * @param msg the pattern match is applied to this Message's * subject header * @return true if the pattern match succeeds, otherwise false */ @Override public boolean match(Message msg) { String subj; try { subj = msg.getSubject(); } catch (Exception e) { return false; } if (subj == null) return false; return super.match(subj); }
/** * Equality comparison. */ public boolean equals(Object obj) { if (!(obj instanceof SubjectTerm)) return false; return super.equals(obj); } }
/** * Compute a hashCode for this object. */ public int hashCode() { // XXX - depends on header comparisons being case independent return headerName.toLowerCase(Locale.ENGLISH).hashCode() + super.hashCode(); } }
/** * Check if the "text" terms in the given SearchTerm contain * non US-ASCII characters. * * @param term the search term * @return true if only ASCII */ public static boolean isAscii(SearchTerm term) { if (term instanceof AndTerm) return isAscii(((AndTerm)term).getTerms()); else if (term instanceof OrTerm) return isAscii(((OrTerm)term).getTerms()); else if (term instanceof NotTerm) return isAscii(((NotTerm)term).getTerm()); else if (term instanceof StringTerm) return isAscii(((StringTerm)term).getPattern()); else if (term instanceof AddressTerm) return isAscii(((AddressTerm)term).getAddress().toString()); // Any other term returns true. return true; }
/** * Check whether the address pattern specified in the constructor is * a substring of the string representation of the given Address * object. <p> * * Note that if the string representation of the given Address object * contains charset or transfer encodings, the encodings must be * accounted for, during the match process. <p> * * @param a The comparison is applied to this Address object. * @return true if the match succeeds, otherwise false. */ protected boolean match(Address a) { if (a instanceof InternetAddress) { InternetAddress ia = (InternetAddress)a; // We dont use toString() to get "a"'s String representation, // because InternetAddress.toString() returns a RFC 2047 // encoded string, which isn't what we need here. return super.match(ia.toUnicodeString()); } else return super.match(a.toString()); }
/** * Equality comparison. */ @Override public boolean equals(Object obj) { if (!(obj instanceof BodyTerm)) return false; return super.equals(obj); } }
/** * Compute a hashCode for this object. */ @Override public int hashCode() { // XXX - depends on header comparisons being case independent return headerName.toLowerCase(Locale.ENGLISH).hashCode() + super.hashCode(); } }