if (name.equalsIgnoreCase("inbox")) return inbox;
if (name.equalsIgnoreCase("trash")) name = "trash";
MailTree mt = mailboxTree(name, create, throwexn);
- /* FIXME: throw throwexn here
- if (mt==null || mt.getMailbox()==null)
- Log.error("mt==null", name);
- */
- return mt==null ? null : mt.getMailbox();
+ Mailbox ret = mt==null ? null : mt.getMailbox();
+ if (ret==null && throwexn) throw new Server.No("no such mailbox " + name);
+ return ret;
}
private MailTree mailboxTree(String name, boolean create) { return mailboxTree(name, create, true); }
private MailTree mailboxTree(String name, boolean create, boolean throwexn) {
Vec.Int vec = new Vec.Int();
for(Mailbox.Iterator it = selected().iterator(q); it.next();) {
vec.addElement(uid ? it.uid() : it.imapNumber());
- it.setFlags(it.getFlags() & ~Mailbox.Flag.RECENT);
+ if ((it.getFlags() & Mailbox.Flag.RECENT) != 0)
+ it.setFlags(it.getFlags() & ~Mailbox.Flag.RECENT);
}
return vec.dump();
}
public void fetch(Query q, int spec, String[] headers, int start, int end, boolean uid) {
for(Mailbox.Iterator it = selected().iterator(q); it.next(); ) {
- Message message = ((spec & (BODYSTRUCTURE | ENVELOPE | INTERNALDATE | FIELDS | FIELDSNOT | RFC822 |
+ Message message =
+ ((spec & (BODYSTRUCTURE | ENVELOPE | INTERNALDATE | FIELDS | FIELDSNOT | RFC822 |
RFC822TEXT | RFC822SIZE | HEADERNOT | HEADER)) != 0) ? it.cur() : null;
long size = message == null ? 0 : message.getLength();
client.fetch(it.imapNumber(), it.getFlags(), (int)size, message, it.uid());
} else {
Account account = (Account)ret;
((MailboxWrapper)api).root = root = account.getMailbox(IMAP.class);
- MailTree ibt = root.slash("INBOX", false);
+ MailTree ibt = root.slash("inbox", false);
Mailbox ib = ibt==null ? null : ibt.getMailbox();
((MailboxWrapper)api).inbox = inbox = ib;
}