From c497485b2f7e02cb9f411c8773a7e8adbeaa62ea Mon Sep 17 00:00:00 2001 From: Bao-Long Nguyen-Trong Date: Sun, 7 Feb 2010 06:05:11 +0000 Subject: [PATCH] Better message flag management so that we don't end up with (POP3) messages having both X_DOWNLOADED_FULL and X_DOWNLOADED_PARTIAL --- src/com/fsck/k9/MessagingController.java | 33 ++++++++++++++---------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/com/fsck/k9/MessagingController.java b/src/com/fsck/k9/MessagingController.java index 99e09c5a7..f568471dd 100644 --- a/src/com/fsck/k9/MessagingController.java +++ b/src/com/fsck/k9/MessagingController.java @@ -1489,21 +1489,26 @@ public class MessagingController implements Runnable Message localMessage = localFolder.getMessage(message.getUid()); - /* - * Mark the message as fully downloaded if the message size is smaller than - * the FETCH_BODY_SANE_SUGGESTED_SIZE, otherwise mark as only a partial - * download. This will prevent the system from downloading the same message - * twice. - */ - if (message.getSize() < Store.FETCH_BODY_SANE_SUGGESTED_SIZE) + + // Certain (POP3) servers give you the whole message even when you ask for only the first x Kb + if (!message.isSet(Flag.X_DOWNLOADED_FULL)) { - localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true); - } - else - { - // Set a flag indicating that the message has been partially downloaded and - // is ready for view. - localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true); + /* + * Mark the message as fully downloaded if the message size is smaller than + * the FETCH_BODY_SANE_SUGGESTED_SIZE, otherwise mark as only a partial + * download. This will prevent the system from downloading the same message + * twice. + */ + if (message.getSize() < Store.FETCH_BODY_SANE_SUGGESTED_SIZE) + { + localMessage.setFlag(Flag.X_DOWNLOADED_FULL, true); + } + else + { + // Set a flag indicating that the message has been partially downloaded and + // is ready for view. + localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true); + } } } else