1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 09:52:16 -05:00

Added support for propagating "Deleted" flags back to IMAP servers.

* Fixed a typo in original method names (really should have been another commit, but this is the initial upload)
This commit is contained in:
Jesse Vincent 2008-10-28 01:11:05 +00:00
parent ffd7766384
commit 822b3b3daa

View File

@ -336,7 +336,7 @@ public class MessagingController implements Runnable {
} }
put("synchronizeMailbox", listener, new Runnable() { put("synchronizeMailbox", listener, new Runnable() {
public void run() { public void run() {
synchronizeMailboxSyncronous(account, folder); synchronizeMailboxSynchronous(account, folder);
} }
}); });
} }
@ -353,7 +353,7 @@ public class MessagingController implements Runnable {
* *
* TODO Break this method up into smaller chunks. * TODO Break this method up into smaller chunks.
*/ */
public void synchronizeMailboxSyncronous(final Account account, final String folder) { public void synchronizeMailboxSynchronous(final Account account, final String folder) {
for (MessagingListener l : mListeners) { for (MessagingListener l : mListeners) {
l.synchronizeMailboxStarted(account, folder); l.synchronizeMailboxStarted(account, folder);
} }
@ -421,9 +421,6 @@ public class MessagingController implements Runnable {
*/ */
remoteFolder.open(OpenMode.READ_WRITE); remoteFolder.open(OpenMode.READ_WRITE);
/*
* Trash any remote messages that are marked as trashed locally.
*/
/* /*
* Get the remote message count. * Get the remote message count.
@ -447,6 +444,12 @@ public class MessagingController implements Runnable {
remoteUidMap.put(message.getUid(), message); remoteUidMap.put(message.getUid(), message);
} }
/* /*
* Get a list of the messages that are in the remote list but not on the * Get a list of the messages that are in the remote list but not on the
* local store, or messages that are in the local store but failed to download * local store, or messages that are in the local store but failed to download
@ -455,13 +458,28 @@ public class MessagingController implements Runnable {
for (Message message : remoteMessages) { for (Message message : remoteMessages) {
Message localMessage = localUidMap.get(message.getUid()); Message localMessage = localUidMap.get(message.getUid());
if (localMessage == null || if (localMessage == null ||
(!localMessage.isSet(Flag.X_DOWNLOADED_FULL) && (!localMessage.isSet(Flag.DELETED) &&
!localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))) { !localMessage.isSet(Flag.X_DOWNLOADED_FULL) &&
!localMessage.isSet(Flag.X_DOWNLOADED_PARTIAL))) {
unsyncedMessages.add(message); unsyncedMessages.add(message);
} }
} }
} }
/*
* Trash any remote messages that are marked as trashed locally.
*/
for (Message message : localMessages) {
Message remoteMessage = remoteUidMap.get(message.getUid());
// skip things deleted on the server side
if (remoteMessage != null && message.isSet(Flag.DELETED)) {
remoteMessage.setFlag(Flag.DELETED, true);
}
}
/* /*
* A list of messages that were downloaded and which did not have the Seen flag set. * A list of messages that were downloaded and which did not have the Seen flag set.
* This will serve to indicate the true "new" message count that will be reported to * This will serve to indicate the true "new" message count that will be reported to
@ -1414,7 +1432,7 @@ s * critical data as fast as possible, and then we'll fill in the de
} }
for (Account account : accounts) { for (Account account : accounts) {
sendPendingMessagesSynchronous(account); sendPendingMessagesSynchronous(account);
synchronizeMailboxSyncronous(account, Email.INBOX); synchronizeMailboxSynchronous(account, Email.INBOX);
} }
for (MessagingListener l : mListeners) { for (MessagingListener l : mListeners) {
l.checkMailFinished(context, account); l.checkMailFinished(context, account);