import java.text.*;
import java.io.*;
+// FEATURE: IDLE extension for blackberries
+
// FIXME: this is valid LSUB "" asdfdas%*%*%*%*SFEFGWEF
// FIXME: be very careful about where/when we quotify stuff
// FIXME: 'UID FOO 100:*' must match at least one message even if all UIDs less than 100
t = new Parser.Token[] { parser.token("FLAGS"), parser.token("INTERNALDATE"),
parser.token("RFC822.SIZE") };
}
+ boolean looked_at_body = false;
for(int i=0; i<t.length; i++) {
if (r.length() > initlen) r.append(" ");
if (t[i] == null || t[i].s == null) continue;
} else if (!(s.equals("BODY.PEEK") || s.equals("BODY"))) { throw new Server.No("unknown fetch argument: " + s);
} else {
if (s.equalsIgnoreCase("BODY.PEEK")) spec |= PEEK;
- //else if (e) api.addFlags(Query.imapNumber(new int[] { num, num }), Mailbox.Flag.SEEN, false, false);
+ looked_at_body = true;
if (i >= t.length - 1 || t[i+1].type != Parser.Token.LIST) {
spec |= BODYSTRUCTURE;
if (e) { r.append(" "); r.append(Printer.bodystructure(m)); } continue;
- //{ if (e) { r.append(" "); r.append(Printer.qq(m.body)); } continue; }
+ //if (e) { r.append(" "); r.append(Printer.qq(m.getBody().getStream())); } continue;
}
Fountain payload = Fountain.Util.create("");
r.append("[");
if (e) { r.append("] "); r.append(Printer.qq(payload.getStream())); }
}
}
+ if ((spec & PEEK) == 0 && looked_at_body && e)
+ api.addFlags(Query.imapNumber(new int[] { num, num }), Mailbox.Flag.SEEN, false, false);
if (e) {
r.append(")");
println("* " + r.toString());
public static String qq(Stream stream) {
StringBuffer sb = new StringBuffer();
stream.transcribe(sb);
- return sb.toString();
+ return qq(sb.toString());
}
public static String qq(String s) {
StringBuffer ret = new StringBuffer();