diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 46a490fad..9ea293662 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -1183,7 +1183,7 @@ public class MessagingController implements Runnable { if (remoteUidMap.get(localMessage.getUid()) == null) { - localMessage.setFlag(Flag.X_DESTROYED, true); + localMessage.destroy(); for (MessagingListener l : getListeners(listener)) { @@ -2316,7 +2316,7 @@ public class MessagingController implements Runnable * delete ours and move on. A sync will get the server message * if we need to be able to see it. */ - localMessage.setFlag(Flag.X_DESTROYED, true); + localMessage.destroy(); } else { @@ -3507,7 +3507,7 @@ public class MessagingController implements Runnable { if (message.isSet(Flag.DELETED)) { - message.setFlag(Flag.X_DESTROYED, true); + message.destroy(); continue; } if (message.isSet(Flag.FLAGGED)) diff --git a/src/com/fsck/k9/mail/Message.java b/src/com/fsck/k9/mail/Message.java index 0da0bdcf7..0644e23e0 100644 --- a/src/com/fsck/k9/mail/Message.java +++ b/src/com/fsck/k9/mail/Message.java @@ -199,6 +199,9 @@ public abstract class Message implements Part, Body return mFlags.contains(flag); } + + public void destroy() throws MessagingException {} + public abstract void saveChanges() throws MessagingException; public abstract void setEncoding(String encoding); diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 405cfd2b6..53df5db77 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -1158,7 +1158,7 @@ public class LocalStore extends Store implements Serializable { listener.messageRemoved(messages[i]); } - messages[i].setFlag(Flag.X_DESTROYED, true); + messages[i].destroy(); } } @@ -4879,8 +4879,6 @@ public class LocalStore extends Store implements Serializable } else if (flag == Flag.X_DESTROYED && set) { - ((LocalFolder) mFolder).deleteAttachments(mId); - mDb.execSQL("DELETE FROM messages WHERE id = ?", new Object[] { mId }); } /* @@ -4978,7 +4976,16 @@ public class LocalStore extends Store implements Serializable } - + /* + * Completely remove a message from the local database + */ + @Override + public void destroy() throws MessagingException + { + ((LocalFolder) mFolder).deleteAttachments(mId); + mDb.execSQL("DELETE FROM messages WHERE id = ?", new Object[] { mId }); + setFlag(Flag.X_DESTROYED, true); + } private void loadHeaders()