use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class LocalFolder method setLastPush.
@Override
public void setLastPush(final long lastChecked) throws MessagingException {
try {
open(OPEN_MODE_RW);
LocalFolder.super.setLastPush(lastChecked);
} catch (MessagingException e) {
throw new WrappedException(e);
}
updateFolderColumn("last_pushed", lastChecked);
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class LocalFolder method setLastChecked.
@Override
public void setLastChecked(final long lastChecked) throws MessagingException {
try {
open(OPEN_MODE_RW);
LocalFolder.super.setLastChecked(lastChecked);
} catch (MessagingException e) {
throw new WrappedException(e);
}
updateFolderColumn("last_updated", lastChecked);
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessagingController method downloadSaneBody.
private void downloadSaneBody(Account account, Folder remoteFolder, LocalFolder localFolder, Message message) throws MessagingException {
/*
* The provider was unable to get the structure of the message, so
* we'll download a reasonable portion of the messge and mark it as
* incomplete so the entire thing can be downloaded later if the user
* wishes to download it.
*/
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.BODY_SANE);
/*
* TODO a good optimization here would be to make sure that all Stores set
* the proper size after this fetch and compare the before and after size. If
* they equal we can mark this SYNCHRONIZED instead of PARTIALLY_SYNCHRONIZED
*/
remoteFolder.fetch(Collections.singletonList(message), fp, null);
// Store the updated message locally
localFolder.appendMessages(Collections.singletonList(message));
Message localMessage = localFolder.getMessage(message.getUid());
// 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)) {
/*
* Mark the message as fully downloaded if the message size is smaller than
* the account's autodownload size limit, otherwise mark as only a partial
* download. This will prevent the system from downloading the same message
* twice.
*
* If there is no limit on autodownload size, that's the same as the message
* being smaller than the max size
*/
if (account.getMaximumAutoDownloadMessageSize() == 0 || message.getSize() < account.getMaximumAutoDownloadMessageSize()) {
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);
}
}
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessagingController method moveMessageToDraftsFolder.
private void moveMessageToDraftsFolder(Account account, Folder localFolder, Store localStore, Message message) throws MessagingException {
LocalFolder draftsFolder = (LocalFolder) localStore.getFolder(account.getDraftsFolderName());
localFolder.moveMessages(Collections.singletonList(message), draftsFolder);
}
use of com.fsck.k9.mail.MessagingException in project k-9 by k9mail.
the class MessagingController method syncFlags.
private boolean syncFlags(LocalMessage localMessage, Message remoteMessage) throws MessagingException {
boolean messageChanged = false;
if (localMessage == null || localMessage.isSet(Flag.DELETED)) {
return false;
}
if (remoteMessage.isSet(Flag.DELETED)) {
if (localMessage.getFolder().syncRemoteDeletions()) {
localMessage.setFlag(Flag.DELETED, true);
messageChanged = true;
}
} else {
for (Flag flag : MessagingController.SYNC_FLAGS) {
if (remoteMessage.isSet(flag) != localMessage.isSet(flag)) {
localMessage.setFlag(flag, remoteMessage.isSet(flag));
messageChanged = true;
}
}
}
return messageChanged;
}
Aggregations