From 3eb05179ee2e1b2161f62240cc1634525af23bb5 Mon Sep 17 00:00:00 2001 From: ashley willis Date: Fri, 27 Jan 2012 23:33:04 -0600 Subject: [PATCH] removed outdated code: MessagingController.processPendingMoveOrCopyOld() and related, Message.delete() and its overrides. --- .../k9/controller/MessagingController.java | 69 ------------------- src/com/fsck/k9/mail/Folder.java | 7 +- src/com/fsck/k9/mail/Message.java | 2 - src/com/fsck/k9/mail/store/ImapStore.java | 5 -- src/com/fsck/k9/mail/store/Pop3Store.java | 13 ---- src/com/fsck/k9/mail/store/WebDavStore.java | 7 -- 6 files changed, 3 insertions(+), 100 deletions(-) diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index ae5a14d2c..2a48fee64 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -114,7 +114,6 @@ public class MessagingController implements Runnable { * So 25k gives good performance and a reasonable data footprint. Sounds good to me. */ - private static final String PENDING_COMMAND_MOVE_OR_COPY = "com.fsck.k9.MessagingController.moveOrCopy"; private static final String PENDING_COMMAND_MOVE_OR_COPY_BULK = "com.fsck.k9.MessagingController.moveOrCopyBulk"; private static final String PENDING_COMMAND_EMPTY_TRASH = "com.fsck.k9.MessagingController.emptyTrash"; private static final String PENDING_COMMAND_SET_FLAG_BULK = "com.fsck.k9.MessagingController.setFlagBulk"; @@ -1916,8 +1915,6 @@ public class MessagingController implements Runnable { processPendingMarkAllAsRead(command, account); } else if (PENDING_COMMAND_MOVE_OR_COPY_BULK.equals(command.command)) { processPendingMoveOrCopy(command, account); - } else if (PENDING_COMMAND_MOVE_OR_COPY.equals(command.command)) { - processPendingMoveOrCopyOld(command, account); } else if (PENDING_COMMAND_EMPTY_TRASH.equals(command.command)) { processPendingEmptyTrash(command, account); } else if (PENDING_COMMAND_EXPUNGE.equals(command.command)) { @@ -2407,72 +2404,6 @@ public class MessagingController implements Runnable { } } - - // TODO: This method is obsolete and is only for transition from K-9 2.0 to K-9 2.1 - // Eventually, it should be removed - private void processPendingMoveOrCopyOld(PendingCommand command, Account account) - throws MessagingException { - String srcFolder = command.arguments[0]; - String uid = command.arguments[1]; - String destFolder = command.arguments[2]; - String isCopyS = command.arguments[3]; - - boolean isCopy = false; - if (isCopyS != null) { - isCopy = Boolean.parseBoolean(isCopyS); - } - - if (account.getErrorFolderName().equals(srcFolder)) { - return; - } - - Store remoteStore = account.getRemoteStore(); - Folder remoteSrcFolder = remoteStore.getFolder(srcFolder); - Folder remoteDestFolder = remoteStore.getFolder(destFolder); - - if (!remoteSrcFolder.exists()) { - throw new MessagingException("processPendingMoveOrCopyOld: remoteFolder " + srcFolder + " does not exist", true); - } - remoteSrcFolder.open(OpenMode.READ_WRITE); - if (remoteSrcFolder.getMode() != OpenMode.READ_WRITE) { - throw new MessagingException("processPendingMoveOrCopyOld: could not open remoteSrcFolder " + srcFolder + " read/write", true); - } - - Message remoteMessage = null; - if (!uid.startsWith(K9.LOCAL_UID_PREFIX)) { - remoteMessage = remoteSrcFolder.getMessage(uid); - } - if (remoteMessage == null) { - throw new MessagingException("processPendingMoveOrCopyOld: remoteMessage " + uid + " does not exist", true); - } - - if (K9.DEBUG) - Log.d(K9.LOG_TAG, "processPendingMoveOrCopyOld: source folder = " + srcFolder - + ", uid = " + uid + ", destination folder = " + destFolder + ", isCopy = " + isCopy); - - if (!isCopy && destFolder.equals(account.getTrashFolderName())) { - if (K9.DEBUG) - Log.d(K9.LOG_TAG, "processPendingMoveOrCopyOld doing special case for deleting message"); - - remoteMessage.delete(account.getTrashFolderName()); - remoteSrcFolder.close(); - return; - } - - remoteDestFolder.open(OpenMode.READ_WRITE); - if (remoteDestFolder.getMode() != OpenMode.READ_WRITE) { - throw new MessagingException("processPendingMoveOrCopyOld: could not open remoteDestFolder " + srcFolder + " read/write", true); - } - - if (isCopy) { - remoteSrcFolder.copyMessages(new Message[] { remoteMessage }, remoteDestFolder); - } else { - remoteSrcFolder.moveMessages(new Message[] { remoteMessage }, remoteDestFolder); - } - remoteSrcFolder.close(); - remoteDestFolder.close(); - } - private void processPendingMarkAllAsRead(PendingCommand command, Account account) throws MessagingException { String folder = command.arguments[0]; Folder remoteFolder = null; diff --git a/src/com/fsck/k9/mail/Folder.java b/src/com/fsck/k9/mail/Folder.java index ff39fe2ca..10ac982ad 100644 --- a/src/com/fsck/k9/mail/Folder.java +++ b/src/com/fsck/k9/mail/Folder.java @@ -105,10 +105,9 @@ public abstract class Folder { public void moveMessages(Message[] msgs, Folder folder) throws MessagingException {} public void delete(Message[] msgs, String trashFolderName) throws MessagingException { - for (Message message : msgs) { - Message myMessage = getMessage(message.getUid()); - myMessage.delete(trashFolderName); - } +// ASH remove these two lines but keep the empty method +Log.e("ASH", "and i didn't think that Folder.delete(msgs, trashFolderName) ever got called: " + msgs[0].getClass()); +throw new MessagingException("ASH : and i didn't think that Folder.delete(msgs, trashFolderName) ever got called: " + msgs[0].getClass()); } public abstract void setFlags(Message[] messages, Flag[] flags, boolean value) diff --git a/src/com/fsck/k9/mail/Message.java b/src/com/fsck/k9/mail/Message.java index 2a7cd5efd..6d675c56e 100644 --- a/src/com/fsck/k9/mail/Message.java +++ b/src/com/fsck/k9/mail/Message.java @@ -144,8 +144,6 @@ public abstract class Message implements Part, Body { return getContentType().startsWith(mimeType); } - public void delete(String trashFolderName) throws MessagingException {} - /* * TODO Refactor Flags at some point to be able to store user defined flags. */ diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index c6d0f8f45..6f5d15cdb 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -2673,11 +2673,6 @@ public class ImapStore extends Store { super.setFlag(flag, set); mFolder.setFlags(new Message[] { this }, new Flag[] { flag }, set); } - - @Override - public void delete(String trashFolderName) throws MessagingException { - getFolder().delete(new Message[] { this }, trashFolderName); - } } static class ImapBodyPart extends MimeBodyPart { diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index dcb212a29..494a9449d 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -1091,19 +1091,6 @@ public class Pop3Store extends Store { super.setFlag(flag, set); mFolder.setFlags(new Message[] { this }, new Flag[] { flag }, set); } - - @Override - public void delete(String trashFolderName) throws MessagingException { - // try - // { - // Poor POP3 users, we can't copy the message to the Trash folder, but they still want a delete - setFlag(Flag.DELETED, true); - // } -// catch (MessagingException me) -// { -// Log.w(K9.LOG_TAG, "Could not delete non-existent message", me); -// } - } } static class Pop3Capabilities { diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index bdcd2f7a3..cdc5c9263 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -2100,13 +2100,6 @@ public class WebDavStore extends Store { } } - @Override - public void delete(String trashFolderName) throws MessagingException { - WebDavFolder wdFolder = (WebDavFolder) getFolder(); - Log.i(K9.LOG_TAG, "Deleting message by moving to " + trashFolderName); - wdFolder.moveMessages(new Message[] { this }, wdFolder.getStore().getFolder(trashFolderName)); - } - @Override public void setFlag(Flag flag, boolean set) throws MessagingException { super.setFlag(flag, set);