diff --git a/src/com/android/email/MessagingController.java b/src/com/android/email/MessagingController.java index c98729cb3..34c629b9f 100644 --- a/src/com/android/email/MessagingController.java +++ b/src/com/android/email/MessagingController.java @@ -968,7 +968,7 @@ public class MessagingController implements Runnable { Store remoteStore = Store.getInstance(account.getStoreUri(), mApplication, account.getStoreCallbacks()); - final Folder remoteFolder = remoteStore.getFolder(folder); + Folder remoteFolder = remoteStore.getFolder(folder); if (!remoteFolder.exists()) { return; } @@ -998,19 +998,7 @@ public class MessagingController implements Runnable { } if (remoteTrashFolder.exists()) { - remoteFolder.copyMessages(new Message[] { remoteMessage }, remoteTrashFolder, - new Folder.MessageUpdateCallbacks() { - @Override - public void onMessageUidChange(Message message, String newUid) - throws MessagingException { - // update the UID in the original folder to match - // because some stores will have to change it when copying - // to remoteTrashFolder - message.setUid(newUid); - remoteFolder.updateMessages(new Message[] { message }); - } - } - ); + remoteFolder.copyMessages(new Message[] { remoteMessage }, remoteTrashFolder); } remoteMessage.setFlag(Flag.DELETED, true); @@ -1379,7 +1367,9 @@ public class MessagingController implements Runnable { message.setFlag(Flag.X_SEND_IN_PROGRESS, true); sender.sendMessage(message); message.setFlag(Flag.X_SEND_IN_PROGRESS, false); - localFolder.copyMessages(new Message[] { message }, localSentFolder, null); + localFolder.copyMessages( + new Message[] { message }, + localSentFolder); PendingCommand command = new PendingCommand(); command.command = PENDING_COMMAND_APPEND; @@ -1435,7 +1425,7 @@ public class MessagingController implements Runnable { Folder localFolder = localStore.getFolder(folder); Folder localTrashFolder = localStore.getFolder(account.getTrashFolderName()); - localFolder.copyMessages(new Message[] { message }, localTrashFolder, null); + localFolder.copyMessages(new Message[] { message }, localTrashFolder); message.setFlag(Flag.DELETED, true); if (account.getDeletePolicy() == Account.DELETE_POLICY_ON_DELETE) { diff --git a/src/com/android/email/mail/Folder.java b/src/com/android/email/mail/Folder.java index 68d0a7cc4..444915579 100644 --- a/src/com/android/email/mail/Folder.java +++ b/src/com/android/email/mail/Folder.java @@ -122,10 +122,7 @@ public abstract class Folder { public abstract void appendMessages(Message[] messages) throws MessagingException; - public abstract void copyMessages(Message[] msgs, Folder folder, - MessageUpdateCallbacks callbacks) throws MessagingException; - - public abstract void updateMessages(Message[] messages) throws MessagingException; + public abstract void copyMessages(Message[] msgs, Folder folder) throws MessagingException; public abstract void setFlags(Message[] messages, Flag[] flags, boolean value) throws MessagingException; @@ -202,20 +199,7 @@ public abstract class Folder { public void setPersistentStringAndMessageFlags(String key, String value, Flag[] setFlags, Flag[] clearFlags) throws MessagingException; } - - /** - * Callback interface by which a folder can report UID changes caused by certain operations. - */ - public abstract static class MessageUpdateCallbacks { - /** - * The operation caused the message's UID to change - * @param message The message for which the UID changed - * @param newUid The new UID for the message - */ - public abstract void onMessageUidChange(Message message, String newUid) - throws MessagingException; - } - + @Override public String toString() { return getName(); diff --git a/src/com/android/email/mail/exchange/ExchangeFolderExample.java b/src/com/android/email/mail/exchange/ExchangeFolderExample.java index a2ab16caa..3434f15a1 100644 --- a/src/com/android/email/mail/exchange/ExchangeFolderExample.java +++ b/src/com/android/email/mail/exchange/ExchangeFolderExample.java @@ -22,7 +22,6 @@ import com.android.email.mail.Folder; import com.android.email.mail.Message; import com.android.email.mail.MessageRetrievalListener; import com.android.email.mail.MessagingException; -import com.android.email.mail.Folder.MessageUpdateCallbacks; /** * Sample code for implementing a new server folder. See also ExchangeStoreExample, @@ -58,8 +57,7 @@ public class ExchangeFolderExample extends Folder { } @Override - public void copyMessages(Message[] msgs, Folder folder, MessageUpdateCallbacks callbacks) - throws MessagingException { + public void copyMessages(Message[] msgs, Folder folder) throws MessagingException { // TODO Implement this function } @@ -164,10 +162,6 @@ public class ExchangeFolderExample extends Folder { public void setFlags(Message[] messages, Flag[] flags, boolean value) throws MessagingException { // TODO Implement this function } - - @Override - public void updateMessages(Message[] messages) throws MessagingException { - // TODO Implement this function, if required - // (only required for stores that call MessageUpdateCallbacks) - } + + } diff --git a/src/com/android/email/mail/store/ImapStore.java b/src/com/android/email/mail/store/ImapStore.java index dc24659d8..1b09b6c85 100644 --- a/src/com/android/email/mail/store/ImapStore.java +++ b/src/com/android/email/mail/store/ImapStore.java @@ -29,7 +29,6 @@ import com.android.email.mail.MessagingException; import com.android.email.mail.Part; import com.android.email.mail.Store; import com.android.email.mail.Transport; -import com.android.email.mail.Folder.MessageUpdateCallbacks; import com.android.email.mail.Folder.PersistentDataCallbacks; import com.android.email.mail.internet.MimeBodyPart; import com.android.email.mail.internet.MimeHeader; @@ -483,8 +482,7 @@ public class ImapStore extends Store { } @Override - public void copyMessages(Message[] messages, Folder folder, - MessageUpdateCallbacks callbacks) throws MessagingException { + public void copyMessages(Message[] messages, Folder folder) throws MessagingException { checkOpen(); String[] uids = new String[messages.length]; for (int i = 0, count = messages.length; i < count; i++) { @@ -499,14 +497,6 @@ public class ImapStore extends Store { throw ioExceptionHandler(mConnection, ioe); } } - - /** - * This is only required for stores that call MessageUpdateCallbacks - */ - @Override - public void updateMessages(Message[] messages) throws MessagingException { - throw new UnsupportedOperationException("unimplemented"); - } @Override public int getMessageCount() { diff --git a/src/com/android/email/mail/store/LocalStore.java b/src/com/android/email/mail/store/LocalStore.java index 8bdbe90eb..205a2863e 100644 --- a/src/com/android/email/mail/store/LocalStore.java +++ b/src/com/android/email/mail/store/LocalStore.java @@ -29,7 +29,6 @@ import com.android.email.mail.MessageRetrievalListener; import com.android.email.mail.MessagingException; import com.android.email.mail.Part; import com.android.email.mail.Store; -import com.android.email.mail.Folder.MessageUpdateCallbacks; import com.android.email.mail.Message.RecipientType; import com.android.email.mail.internet.MimeBodyPart; import com.android.email.mail.internet.MimeHeader; @@ -879,8 +878,7 @@ public class LocalStore extends Store { } @Override - public void copyMessages(Message[] msgs, Folder folder, MessageUpdateCallbacks callbacks) - throws MessagingException { + public void copyMessages(Message[] msgs, Folder folder) throws MessagingException { if (!(folder instanceof LocalFolder)) { throw new MessagingException("copyMessages called with incorrect Folder"); } @@ -979,17 +977,6 @@ public class LocalStore extends Store { } } - /** - * Note: Although implemented here, this is only required for stores that call - * MessageUpdateCallbacks - */ - @Override - public void updateMessages(Message[] messages) throws MessagingException { - for (Message message : messages) { - updateMessage((LocalMessage)message); - } - } - /** * Update the given message in the LocalStore without first deleting the existing * message (contrast with appendMessages). This method is used to store changes diff --git a/src/com/android/email/mail/store/Pop3Store.java b/src/com/android/email/mail/store/Pop3Store.java index a3a65d168..57aaef91b 100644 --- a/src/com/android/email/mail/store/Pop3Store.java +++ b/src/com/android/email/mail/store/Pop3Store.java @@ -27,7 +27,6 @@ import com.android.email.mail.MessageRetrievalListener; import com.android.email.mail.MessagingException; import com.android.email.mail.Store; import com.android.email.mail.Transport; -import com.android.email.mail.Folder.MessageUpdateCallbacks; import com.android.email.mail.Folder.OpenMode; import com.android.email.mail.Folder.PersistentDataCallbacks; import com.android.email.mail.internet.MimeMessage; @@ -791,19 +790,10 @@ public class Pop3Store extends Store { } @Override - public void copyMessages(Message[] msgs, Folder folder, MessageUpdateCallbacks callbacks) - throws MessagingException { + public void copyMessages(Message[] msgs, Folder folder) throws MessagingException { throw new UnsupportedOperationException("copyMessages is not supported in POP3"); } - /** - * This is only required for stores that call MessageUpdateCallbacks - */ - @Override - public void updateMessages(Message[] messages) throws MessagingException { - throw new UnsupportedOperationException("unimplemented"); - } - // private boolean isRoundTripModeSuggested() { // long roundTripMethodMs = // (uncachedMessageCount * 2 * mLatencyMs); diff --git a/tests/src/com/android/email/mail/MockFolder.java b/tests/src/com/android/email/mail/MockFolder.java index 0a25c8f67..bd57be26d 100644 --- a/tests/src/com/android/email/mail/MockFolder.java +++ b/tests/src/com/android/email/mail/MockFolder.java @@ -31,8 +31,7 @@ public class MockFolder extends Folder { } @Override - public void copyMessages(Message[] msgs, Folder folder, MessageUpdateCallbacks callbacks) - throws MessagingException { + public void copyMessages(Message[] msgs, Folder folder) throws MessagingException { // TODO Auto-generated method stub } @@ -142,10 +141,4 @@ public class MockFolder extends Folder { } - @Override - public void updateMessages(Message[] messages) throws MessagingException { - // TODO Auto-generated method stub - - } - } diff --git a/tests/src/com/android/email/mail/store/Pop3StoreUnitTests.java b/tests/src/com/android/email/mail/store/Pop3StoreUnitTests.java index cbdf5e125..45751437d 100644 --- a/tests/src/com/android/email/mail/store/Pop3StoreUnitTests.java +++ b/tests/src/com/android/email/mail/store/Pop3StoreUnitTests.java @@ -241,7 +241,7 @@ public class Pop3StoreUnitTests extends AndroidTestCase { // copyMessages() is unsupported try { - mFolder.copyMessages(null, null, null); + mFolder.copyMessages(null, null); fail("Exception not thrown by copyMessages()"); } catch (UnsupportedOperationException e) { // expected - succeed