From 235609d04e95db2097efcc3c999a8fbd6c1ae23e Mon Sep 17 00:00:00 2001 From: Andy Stadler Date: Tue, 5 May 2009 16:36:31 -0700 Subject: [PATCH] AI 148334: Provide a new entry in MessageUpdateCallbacks by which the store can indicate that the message of interest no longer exists. This is used in remoteFolder.copyMessages, for example because the message was already deleted by another client. BUG=1807499 Automated import of CL 148334 --- src/com/android/email/MessagingController.java | 14 ++++++++++++++ src/com/android/email/mail/Folder.java | 11 +++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index 1bf50cdc7..caf4c7178 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -1113,6 +1113,20 @@ public class MessagingController implements Runnable { localTrashFolder.updateMessage(localMessage); } } + + /** + * This will be called if the deleted message doesn't exist and can't be + * deleted (e.g. it was already deleted from the server.) In this case, + * attempt to delete the local copy as well. + */ + public void onMessageNotFound(Message message) throws MessagingException { + LocalMessage localMessage = + (LocalMessage) localTrashFolder.getMessage(message.getUid()); + if (localMessage != null) { + localMessage.setFlag(Flag.DELETED, true); + } + } + } ); } diff --git a/src/com/android/email/mail/Folder.java b/src/com/android/email/mail/Folder.java index 8bb0e7caa..dd99172ea 100644 --- a/src/com/android/email/mail/Folder.java +++ b/src/com/android/email/mail/Folder.java @@ -210,8 +210,15 @@ public abstract class Folder { * @param message The message for which the UID changed * @param newUid The new UID for the message */ - public void onMessageUidChange(Message message, String newUid) - throws MessagingException; + public void onMessageUidChange(Message message, String newUid) throws MessagingException; + + /** + * The operation could not be completed because the message doesn't exist + * (for example, it was already deleted from the server side.) + * @param message The message that does not exist + * @throws MessagingException + */ + public void onMessageNotFound(Message message) throws MessagingException; } @Override