From 5789b385a82c12f46c4304692a1a7e69805872cc Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 18 Dec 2009 02:33:18 +0000 Subject: [PATCH] first pass at working around messaging controller perf insanity port listLocalMessagesSynchronous back into the MessagingController revert some stuff --- src/com/fsck/k9/MessagingController.java | 47 +++++++++++++++++++++++ src/com/fsck/k9/activity/MessageList.java | 1 + 2 files changed, 48 insertions(+) diff --git a/src/com/fsck/k9/MessagingController.java b/src/com/fsck/k9/MessagingController.java index 46c012edb..93981693f 100644 --- a/src/com/fsck/k9/MessagingController.java +++ b/src/com/fsck/k9/MessagingController.java @@ -666,6 +666,53 @@ public class MessagingController implements Runnable }); } + public void listLocalMessagesSynchronous(final Account account, final String folder, final MessagingListener listener) + { + + try + { + Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication); + Folder localFolder; + localFolder = localStore.getFolder(folder); + localFolder.open(OpenMode.READ_WRITE); + localFolder.getMessages( + new MessageRetrievalListener() + { + int totalDone = 0; + public void messageStarted(String uid, int number, int ofTotal){}; + + + public void messagesFinished(int total) {}; + + public void messageFinished(Message message, int number, int ofTotal) + { + + if (isMessageSuppressed(account, folder, message) == false) + { + List messages = new ArrayList(); + messages.add(message); + listener.listLocalMessagesAddMessages(account,folder, messages); + totalDone++; + + } + else + { + listener.listLocalMessagesRemoveMessage(account, folder, message); + + } + } + }, + false // Skip deleted messages + ); + localFolder.close(false); + } + catch (Exception e) + { + } + finally + { + } +} public void loadMoreMessages(Account account, String folder, MessagingListener listener) { try diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 417d72429..8801b2d33 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -2474,4 +2474,5 @@ public class MessageList { } + }