From dc96bf318635ad860c4e2595b3c68f52098ea954 Mon Sep 17 00:00:00 2001 From: cketti Date: Sat, 14 May 2011 23:30:47 +0200 Subject: [PATCH] Only mark all messages as read on the server if that's supported This change prevents K-9 Mail from establishing a connection to the server when all messages are marked as read on a POP3 account. --- src/com/fsck/k9/controller/MessagingController.java | 2 +- src/com/fsck/k9/mail/store/Pop3Store.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index cc408d051..da325a287 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -2378,7 +2378,7 @@ public class MessagingController implements Runnable { Store remoteStore = account.getRemoteStore(); remoteFolder = remoteStore.getFolder(folder); - if (!remoteFolder.exists()) { + if (!remoteFolder.exists() || !remoteFolder.isFlagSupported(Flag.SEEN)) { return; } remoteFolder.open(OpenMode.READ_WRITE); diff --git a/src/com/fsck/k9/mail/store/Pop3Store.java b/src/com/fsck/k9/mail/store/Pop3Store.java index cb5b64b01..de40edea1 100644 --- a/src/com/fsck/k9/mail/store/Pop3Store.java +++ b/src/com/fsck/k9/mail/store/Pop3Store.java @@ -283,7 +283,9 @@ public class Pop3Store extends Store { @Override public void close() { try { - executeSimpleCommand("QUIT"); + if (isOpen()) { + executeSimpleCommand("QUIT"); + } } catch (Exception e) { /* * QUIT may fail if the connection is already closed. We don't care. It's just