From 47a80fbd6cf5946860a2a62d8469685798603545 Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Wed, 14 Apr 2010 13:02:04 +0000 Subject: [PATCH] Fixes Issue 1130 Fixes Issue 1308 Some IMAP servers seem not to provide an INTERNALDATE response. --- src/com/fsck/k9/MessagingController.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/com/fsck/k9/MessagingController.java b/src/com/fsck/k9/MessagingController.java index ac4c3eacb..75b368bfe 100644 --- a/src/com/fsck/k9/MessagingController.java +++ b/src/com/fsck/k9/MessagingController.java @@ -1983,14 +1983,14 @@ public class MessagingController implements Runnable remoteFolder.fetch(new Message[] { remoteMessage }, fp, null); Date localDate = localMessage.getInternalDate(); Date remoteDate = remoteMessage.getInternalDate(); - if (remoteDate.compareTo(localDate) > 0) + if (remoteDate != null && remoteDate.compareTo(localDate) > 0) { /* * If the remote message is newer than ours we'll just * delete ours and move on. A sync will get the server message * if we need to be able to see it. */ - localMessage.setFlag(Flag.DELETED, true); + localMessage.setFlag(Flag.X_DESTROYED, true); } else { @@ -2011,11 +2011,14 @@ public class MessagingController implements Runnable { l.messageUidChanged(account, folder, oldUid, localMessage.getUid()); } - remoteMessage.setFlag(Flag.DELETED, true); - if (Account.EXPUNGE_IMMEDIATELY.equals(account.getExpungePolicy())) - { - remoteFolder.expunge(); - } + if (remoteDate != null) + { + remoteMessage.setFlag(Flag.DELETED, true); + if (Account.EXPUNGE_IMMEDIATELY.equals(account.getExpungePolicy())) + { + remoteFolder.expunge(); + } + } } } }