public static Query arrival(Date earliest, Date latest) { return new Query(ARRIVAL, null,0,0,0,null,null, earliest, latest); }
public static Query header(String name, String val) { return new Query(HEADER, null, 0, 0, 0, name, val, null, null); }
public static Query size(int min, int max) { return new Query(SIZE, null, min, max, 0, null, null, null, null); }
- public static Query body(String text) { return new Query(BODY, null, 0, 0, 0, null, text, null, null); }
public static Query flags(int flags) { return new Query(FLAGS, null, 0, 0, flags, null, null, null, null); }
+ public static Query body(String text) { return new Query(BODY, null, 0, 0, 0, null, text, null, null); }
+ public static Query body(String text) { return new Query(FULL, null, 0, 0, 0, null, text, null, null); }
private Query(int type, Query[] q, int min, int max, int flags, String key, String text, Date earliest, Date latest) {
this.type = type; this.q = q; this.min = min; this.max = max; this.flags = flags; this.key = key; this.text = text;
public static int SIZE = 9;
public static int FLAGS = 10;
public static int BODY = 11;
+ public static int FULL = 12;
public final int type;
public final Query[] q;
case SIZE: return m.size >= min && m.size <= max;
case FLAGS: return mbox.getFlags(flags);
case HEADER: return m.headers.get(key) != null && ((String)m.headers.get(key)).indexOf(text) != -1;
- case HEADER: return m.body.indexOf(text) != -1;
+ case BODY: return m.body.indexOf(text) != -1;
+ case FULL: return m.body.indexOf(text) != -1 || m.allHeaders.indexOf(text) != -1;
default: throw new Error("this should not happen");
}
}