Merge "Fix IMAP send by ensuring system mailboxes exist." into jb-ub-mail-ur9

This commit is contained in:
Yu Ping Hu 2013-03-14 17:17:53 +00:00 committed by Android (Google) Code Review
commit a6cd7cbd63

View File

@ -3871,10 +3871,14 @@ outer:
} }
if (msg == null) return null; if (msg == null) return null;
final long mailboxId = Mailbox.findMailboxOfType(context, accountId, Mailbox.TYPE_OUTBOX); final Mailbox mailbox = getMailboxByAccountIdAndType(uri.getPathSegments().get(1),
if (mailboxId == Mailbox.NO_MAILBOX) return null; Mailbox.TYPE_OUTBOX);
final Mailbox mailbox = Mailbox.restoreMailboxWithId(context, mailboxId);
if (mailbox == null) return null; if (mailbox == null) return null;
// Make sure the sent mailbox exists, since it will be necessary soon.
// TODO(yph): move system mailbox creation to somewhere sane.
final Mailbox sentMailbox = getMailboxByAccountIdAndType(uri.getPathSegments().get(1),
Mailbox.TYPE_SENT);
if (sentMailbox == null) return null;
final ContentValues values = translateMessage(extras); final ContentValues values = translateMessage(extras);
// Get the Bundle of open fds from the extra // Get the Bundle of open fds from the extra
final Bundle attachmentFds = final Bundle attachmentFds =