am cdd477e1: Delete attachments for mailboxes/messages deleted by server

Merge commit 'cdd477e16a82417fb924abc42a2a834c29fb0db8' into eclair-plus-aosp

* commit 'cdd477e16a82417fb924abc42a2a834c29fb0db8':
  Delete attachments for mailboxes/messages deleted by server
This commit is contained in:
Marc Blank 2009-10-01 00:06:51 -07:00 committed by Android Git Automerger
commit 76d1a8a567
2 changed files with 5 additions and 0 deletions

View File

@ -18,6 +18,7 @@
package com.android.exchange.adapter; package com.android.exchange.adapter;
import com.android.email.mail.Address; import com.android.email.mail.Address;
import com.android.email.provider.AttachmentProvider;
import com.android.email.provider.EmailContent; import com.android.email.provider.EmailContent;
import com.android.email.provider.EmailProvider; import com.android.email.provider.EmailProvider;
import com.android.email.provider.EmailContent.Account; import com.android.email.provider.EmailContent.Account;
@ -425,6 +426,7 @@ public class EmailSyncAdapter extends AbstractSyncAdapter {
for (Long id : deletedEmails) { for (Long id : deletedEmails) {
ops.add(ContentProviderOperation.newDelete( ops.add(ContentProviderOperation.newDelete(
ContentUris.withAppendedId(Message.CONTENT_URI, id)).build()); ContentUris.withAppendedId(Message.CONTENT_URI, id)).build());
AttachmentProvider.deleteAllAttachmentFiles(mContext, mAccount.mId, id);
} }
if (!changedEmails.isEmpty()) { if (!changedEmails.isEmpty()) {
// Server wins in a conflict... // Server wins in a conflict...

View File

@ -17,6 +17,7 @@
package com.android.exchange.adapter; package com.android.exchange.adapter;
import com.android.email.provider.AttachmentProvider;
import com.android.email.provider.EmailContent; import com.android.email.provider.EmailContent;
import com.android.email.provider.EmailProvider; import com.android.email.provider.EmailProvider;
import com.android.email.provider.EmailContent.Account; import com.android.email.provider.EmailContent.Account;
@ -163,6 +164,8 @@ public class FolderSyncParser extends AbstractSyncParser {
ops.add(ContentProviderOperation.newDelete( ops.add(ContentProviderOperation.newDelete(
ContentUris.withAppendedId(Mailbox.CONTENT_URI, ContentUris.withAppendedId(Mailbox.CONTENT_URI,
c.getLong(0))).build()); c.getLong(0))).build());
AttachmentProvider.deleteAllMailboxAttachmentFiles(mContext,
mAccountId, mMailbox.mId);
} }
} finally { } finally {
c.close(); c.close();