for(Mailbox.Iterator it = selected().iterator(q); it.next(); ) {
Message message = ((spec & (BODYSTRUCTURE | ENVELOPE | INTERNALDATE | FIELDS | FIELDSNOT | RFC822 |
RFC822TEXT | RFC822SIZE | HEADERNOT | HEADER)) != 0) ? it.cur() : null;
- int size = message == null ? 0 : message.getLength();
- client.fetch(it.imapNumber(), it.getFlags(), size, message, it.uid());
+ long size = message == null ? 0 : message.getLength();
+ client.fetch(it.imapNumber(), it.getFlags(), (int)size, message, it.uid());
it.setFlags(it.getFlags() & ~Mailbox.Flag.RECENT);
}
}
case EXPUNGE: selected(); api.expunge(); break;
case UNSELECT: selected(); api.unselect(); selected = false; break;
case CREATE: api.create(token().astring()); break;
- case FETCH: selected(); fetch(((lastuid=uid)
- ? Query.uid(token().set(maxn(uid)))
- : Query.imapNumber(token().set(maxn(uid)))),
- lastfetch=token().lx(), 0, 0, 0, uid, 0); break;
+ case FETCH: selected(); lastuid = uid; fetch((uid
+ ? Query.uid(token().set(maxn(uid)))
+ : Query.imapNumber(token().set(maxn(uid)))),
+ lastfetch=token().lx(), 0, 0, 0, uid, 0); break;
case COPY: selected(); api.copy(uid
? Query.uid(token().set(maxn(uid)))
: Query.imapNumber(token().set(maxn(uid))), token().astring()); break;
Date arrival = new Date();
Parser.Token t = token();
if (t.type == t.LIST) { flags = t.flags(); t = token(); }
- if (t.type != t.QUOTED) { arrival = t.datetime(); t = token(); }
+ Parser.Token t2 = token(false);
+ if (t2 != null) { arrival = t.datetime(); t = t2; }
api.append(m, flags, arrival, t.q());
break; }
case STORE: {
return;
}
} catch (Server.Bad b) { println(tag==null ? "* BAD Invalid tag":(tag + " Bad " + b.toString())); Log.warn(this,b);
- } catch (Server.No n) { println(tag==null?"* BAD Invalid tag":(tag+" No " + n.toString())); Log.warn(this,n); }
+ } catch (Server.No n) { println(tag==null?"* BAD Invalid tag":(tag+" No " + n.toString())); Log.warn(this,n);
+ } finally {
+ Log.warn(this, conn.dumpLog()+"\n");
+ }
}
private Parser.Token[] lastfetch = null; // hack
}
public Date datetime() {
if (type != QUOTED) bad("Expected quoted datetime");
- try { return new SimpleDateFormat("dd-MM-yyyy hh:mm:ss zzzz").parse(s.trim());
+ try { return new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss zzzz").parse(s.trim());
} catch (ParseException p) { throw new Server.Bad("invalid datetime format " + s + " : " + p); }
}
public String atom() {
")";
}
+ // FIXME: ugly
+ public static String qq(Stream stream) {
+ StringBuffer sb = new StringBuffer();
+ stream.transcribe(sb);
+ return sb.toString();
+ }
public static String qq(String s) {
StringBuffer ret = new StringBuffer();
ret.append('{');