1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Better message flag management so that we don't end up with (POP3) messages having both X_DOWNLOADED_FULL and X_DOWNLOADED_PARTIAL

This commit is contained in:
Bao-Long Nguyen-Trong 2010-02-07 06:05:11 +00:00
parent 46bff831d1
commit c497485b2f

View File

@ -1489,21 +1489,26 @@ public class MessagingController implements Runnable
Message localMessage = localFolder.getMessage(message.getUid()); Message localMessage = localFolder.getMessage(message.getUid());
/*
* Mark the message as fully downloaded if the message size is smaller than // Certain (POP3) servers give you the whole message even when you ask for only the first x Kb
* the FETCH_BODY_SANE_SUGGESTED_SIZE, otherwise mark as only a partial if (!message.isSet(Flag.X_DOWNLOADED_FULL))
* 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); /*
} * Mark the message as fully downloaded if the message size is smaller than
else * the FETCH_BODY_SANE_SUGGESTED_SIZE, otherwise mark as only a partial
{ * download. This will prevent the system from downloading the same message
// Set a flag indicating that the message has been partially downloaded and * twice.
// is ready for view. */
localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true); 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 else