diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index 0478376d7..e70af5890 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -238,21 +238,15 @@ public class Account implements BaseAccount SharedPreferences prefs = preferences.getPreferences(); - mStoreUri = Utility.base64Decode(prefs.getString(mUuid - + ".storeUri", null)); + mStoreUri = Utility.base64Decode(prefs.getString(mUuid + ".storeUri", null)); mLocalStorageProviderId = prefs.getString(mUuid + ".localStorageProvider", StorageManager.getInstance(K9.app).getDefaultProviderId()); - mTransportUri = Utility.base64Decode(prefs.getString(mUuid - + ".transportUri", null)); + mTransportUri = Utility.base64Decode(prefs.getString(mUuid + ".transportUri", null)); mDescription = prefs.getString(mUuid + ".description", null); mAlwaysBcc = prefs.getString(mUuid + ".alwaysBcc", mAlwaysBcc); - mAutomaticCheckIntervalMinutes = prefs.getInt(mUuid - + ".automaticCheckIntervalMinutes", -1); - mIdleRefreshMinutes = prefs.getInt(mUuid - + ".idleRefreshMinutes", 24); - mSaveAllHeaders = prefs.getBoolean(mUuid - + ".saveAllHeaders", true); - mPushPollOnConnect = prefs.getBoolean(mUuid - + ".pushPollOnConnect", true); + mAutomaticCheckIntervalMinutes = prefs.getInt(mUuid + ".automaticCheckIntervalMinutes", -1); + mIdleRefreshMinutes = prefs.getInt(mUuid + ".idleRefreshMinutes", 24); + mSaveAllHeaders = prefs.getBoolean(mUuid + ".saveAllHeaders", true); + mPushPollOnConnect = prefs.getBoolean(mUuid + ".pushPollOnConnect", true); mDisplayCount = prefs.getInt(mUuid + ".displayCount", K9.DEFAULT_VISIBLE_LIMIT); if (mDisplayCount < 0) { @@ -264,31 +258,21 @@ public class Account implements BaseAccount mNotifySelfNewMail = prefs.getBoolean(mUuid + ".notifySelfNewMail", true); mNotifySync = prefs.getBoolean(mUuid + ".notifyMailCheck", false); mDeletePolicy = prefs.getInt(mUuid + ".deletePolicy", 0); - mDraftsFolderName = prefs.getString(mUuid + ".draftsFolderName", - "Drafts"); - mSentFolderName = prefs.getString(mUuid + ".sentFolderName", - "Sent"); - mTrashFolderName = prefs.getString(mUuid + ".trashFolderName", - "Trash"); - mArchiveFolderName = prefs.getString(mUuid + ".archiveFolderName", - "Archive"); - mSpamFolderName = prefs.getString(mUuid + ".spamFolderName", - "Spam"); - mOutboxFolderName = prefs.getString(mUuid + ".outboxFolderName", - "Outbox"); + mDraftsFolderName = prefs.getString(mUuid + ".draftsFolderName", "Drafts"); + mSentFolderName = prefs.getString(mUuid + ".sentFolderName", "Sent"); + mTrashFolderName = prefs.getString(mUuid + ".trashFolderName", "Trash"); + mArchiveFolderName = prefs.getString(mUuid + ".archiveFolderName", "Archive"); + mSpamFolderName = prefs.getString(mUuid + ".spamFolderName", "Spam"); + mOutboxFolderName = prefs.getString(mUuid + ".outboxFolderName", "Outbox"); mExpungePolicy = prefs.getString(mUuid + ".expungePolicy", EXPUNGE_IMMEDIATELY); mSyncRemoteDeletions = prefs.getBoolean(mUuid + ".syncRemoteDeletions", true); mMaxPushFolders = prefs.getInt(mUuid + ".maxPushFolders", 10); - goToUnreadMessageSearch = prefs.getBoolean(mUuid + ".goToUnreadMessageSearch", - false); + goToUnreadMessageSearch = prefs.getBoolean(mUuid + ".goToUnreadMessageSearch", false); mNotificationShowsUnreadCount = prefs.getBoolean(mUuid + ".notificationUnreadCount", true); - subscribedFoldersOnly = prefs.getBoolean(mUuid + ".subscribedFoldersOnly", - false); - maximumPolledMessageAge = prefs.getInt(mUuid - + ".maximumPolledMessageAge", -1); - maximumAutoDownloadMessageSize = prefs.getInt(mUuid - + ".maximumAutoDownloadMessageSize", 32768); + subscribedFoldersOnly = prefs.getBoolean(mUuid + ".subscribedFoldersOnly", false); + maximumPolledMessageAge = prefs.getInt(mUuid + ".maximumPolledMessageAge", -1); + maximumAutoDownloadMessageSize = prefs.getInt(mUuid + ".maximumAutoDownloadMessageSize", 32768); mMessageFormat = MessageFormat.valueOf(prefs.getString(mUuid + ".messageFormat", DEFAULT_MESSAGE_FORMAT.name())); mQuoteStyle = QuoteStyle.valueOf(prefs.getString(mUuid + ".quoteStyle", DEFAULT_QUOTE_STYLE.name())); mQuotePrefix = prefs.getString(mUuid + ".quotePrefix", DEFAULT_QUOTE_PREFIX); diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index ed496fd1a..3878a8bae 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -1022,8 +1022,7 @@ public class MessagingController implements Runnable try { if (K9.DEBUG) - Log.d(K9.LOG_TAG, "SYNC: About to process pending commands for account " + - account.getDescription()); + Log.d(K9.LOG_TAG, "SYNC: About to process pending commands for account " + account.getDescription()); try { @@ -1060,7 +1059,6 @@ public class MessagingController implements Runnable { if (K9.DEBUG) Log.v(K9.LOG_TAG, "SYNC: using providedRemoteFolder " + folder); - remoteFolder = providedRemoteFolder; } else @@ -1071,9 +1069,7 @@ public class MessagingController implements Runnable Log.v(K9.LOG_TAG, "SYNC: About to get remote folder " + folder); remoteFolder = remoteStore.getFolder(folder); - - - if (! verifyOrCreateRemoteSpecialFolder(account, folder, remoteFolder, listener)) + if (! verifyOrCreateRemoteSpecialFolder(account, folder, remoteFolder, listener)) { return; } @@ -1081,6 +1077,7 @@ public class MessagingController implements Runnable /* * Synchronization process: + * Open the folder Upload any local messages that are marked as PENDING_UPLOAD (Drafts, Sent, Trash) Get the message count @@ -1088,12 +1085,10 @@ public class MessagingController implements Runnable getMessages(messageCount - K9.DEFAULT_VISIBLE_LIMIT, messageCount) See if we have each message locally, if not fetch it's flags and envelope Get and update the unread count for the folder - Update the remote flags of any messages we have locally with an internal date - newer than the remote message. + Update the remote flags of any messages we have locally with an internal date newer than the remote message. Get the current flags for any messages we have locally but did not just download Update local flags - For any message we have locally but not remotely, delete the local message to keep - cache clean. + For any message we have locally but not remotely, delete the local message to keep cache clean. Download larger parts of any new messages. (Optional) Download small attachments in the background. */ @@ -1109,8 +1104,6 @@ public class MessagingController implements Runnable { if (K9.DEBUG) Log.d(K9.LOG_TAG, "SYNC: Expunging folder " + account.getDescription() + ":" + folder); - - remoteFolder.expunge(); } @@ -1130,17 +1123,16 @@ public class MessagingController implements Runnable Message[] remoteMessageArray = EMPTY_MESSAGE_ARRAY; final ArrayList remoteMessages = new ArrayList(); - // final ArrayList unsyncedMessages = new ArrayList(); HashMap remoteUidMap = new HashMap(); if (K9.DEBUG) Log.v(K9.LOG_TAG, "SYNC: Remote message count for folder " + folder + " is " + remoteMessageCount); final Date earliestDate = account.getEarliestPollDate(); + + if (remoteMessageCount > 0) { - /* - * Message numbers start at 1. - */ + /* Message numbers start at 1. */ int remoteStart; if (visibleLimit > 0 ) { @@ -1229,17 +1221,14 @@ public class MessagingController implements Runnable l.folderStatusChanged(account, folder, unreadMessageCount); } - /* - * Notify listeners that we're finally done. - */ + /* Notify listeners that we're finally done. */ localFolder.setLastChecked(System.currentTimeMillis()); localFolder.setStatus(null); if (K9.DEBUG) - Log.d(K9.LOG_TAG, "Done synchronizing folder " + - account.getDescription() + ":" + folder + " @ " + new Date() + - " with " + newMessages + " new messages"); + Log.d(K9.LOG_TAG, "Done synchronizing folder " + account.getDescription() + ":" + folder + + " @ " + new Date() + " with " + newMessages + " new messages"); for (MessagingListener l : getListeners(listener)) { @@ -1285,14 +1274,10 @@ public class MessagingController implements Runnable for (MessagingListener l : getListeners(listener)) { - l.synchronizeMailboxFailed( - account, - folder, - rootMessage); + l.synchronizeMailboxFailed( account, folder, rootMessage); } addErrorMessage(account, null, e); - Log.e(K9.LOG_TAG, "Failed synchronizing folder " + - account.getDescription() + ":" + folder + " @ " + new Date()); + Log.e(K9.LOG_TAG, "Failed synchronizing folder " + account.getDescription() + ":" + folder + " @ " + new Date()); } finally diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index 2d76e4ba6..46492e23a 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -1052,7 +1052,7 @@ public class Pop3Store extends Store public boolean supportsFetchingFlags() { return false; - }//isFlagSupported + } @Override public boolean equals(Object o)