From 3f0aada43bd3c4cc7ea1dca0a5c883c98cf186ec Mon Sep 17 00:00:00 2001 From: Daniel Applebaum Date: Sat, 22 May 2010 22:00:06 +0000 Subject: [PATCH] Eliminate duplicate calls to notifyAccount while synchronizing a folder. --- .../k9/controller/MessagingController.java | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index dd763a97d..f5bdd31db 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -1540,12 +1540,7 @@ public class MessagingController implements Runnable l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage); } - // Send a notification of this message - if (notifyAccount(mApplication, account, message) == true) - { - newMessages.incrementAndGet(); - } - + } } @@ -1634,7 +1629,15 @@ public class MessagingController implements Runnable l.synchronizeMailboxNewMessage(account, folder, localMessage); } } - notifyAccount(mApplication, account, message); + if (!localMessage.isSet(Flag.SEEN)) + { + // Send a notification of this message + if (notifyAccount(mApplication, account, message) == true) + { + newMessages.incrementAndGet(); + } + } + } catch (MessagingException me) @@ -1748,9 +1751,9 @@ public class MessagingController implements Runnable // Update the listener with what we've found progress.incrementAndGet(); + Message localMessage = localFolder.getMessage(message.getUid()); for (MessagingListener l : getListeners()) { - Message localMessage = localFolder.getMessage(message.getUid()); l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage); l.synchronizeMailboxProgress(account, folder, progress.get(), todo); if (!localMessage.isSet(Flag.SEEN)) @@ -1758,7 +1761,16 @@ public class MessagingController implements Runnable l.synchronizeMailboxNewMessage(account, folder, localMessage); } } - notifyAccount(mApplication, account, message); + if (!localMessage.isSet(Flag.SEEN)) + { + // Send a notification of this message + if (notifyAccount(mApplication, account, message) == true) + { + newMessages.incrementAndGet(); + } + } + + }//for large messsages if (K9.DEBUG) Log.d(K9.LOG_TAG, "SYNC: Done fetching large messages for folder " + folder);