From dba525739e6ce9535a5839808ba49e14d9c43ac0 Mon Sep 17 00:00:00 2001 From: Bao-Long Nguyen-Trong Date: Sun, 14 Dec 2008 06:23:03 +0000 Subject: [PATCH] . Fixed bug # 82: Messages lose their read status when getting new emails from POP3 server --- src/com/fsck/k9/MessagingController.java | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/com/fsck/k9/MessagingController.java b/src/com/fsck/k9/MessagingController.java index d54f9eeff..9b7a9f6d2 100644 --- a/src/com/fsck/k9/MessagingController.java +++ b/src/com/fsck/k9/MessagingController.java @@ -548,22 +548,26 @@ s * critical data as fast as possible, and then we'll fill in the de }); } + FetchProfile fp; + /* * Refresh the flags for any messages in the local store that we didn't just * download. */ - FetchProfile fp = new FetchProfile(); - fp.add(FetchProfile.Item.FLAGS); - remoteFolder.fetch(remoteMessages, fp, null); - for (Message remoteMessage : remoteMessages) { - Message localMessage = localFolder.getMessage(remoteMessage.getUid()); - if (localMessage == null) { - continue; - } - if (remoteMessage.isSet(Flag.SEEN) != localMessage.isSet(Flag.SEEN)) { - localMessage.setFlag(Flag.SEEN, remoteMessage.isSet(Flag.SEEN)); - for (MessagingListener l : mListeners) { - l.synchronizeMailboxNewMessage(account, folder, localMessage); + if (remoteFolder.supportsFetchingFlags()) { + fp = new FetchProfile(); + fp.add(FetchProfile.Item.FLAGS); + remoteFolder.fetch(remoteMessages, fp, null); + for (Message remoteMessage : remoteMessages) { + Message localMessage = localFolder.getMessage(remoteMessage.getUid()); + if (localMessage == null) { + continue; + } + if (remoteMessage.isSet(Flag.SEEN) != localMessage.isSet(Flag.SEEN)) { + localMessage.setFlag(Flag.SEEN, remoteMessage.isSet(Flag.SEEN)); + for (MessagingListener l : mListeners) { + l.synchronizeMailboxNewMessage(account, folder, localMessage); + } } } }