use of com.fsck.k9.mailstore.LocalMessage in project k-9 by k9mail.
the class MessageLoaderHelper method startOrResumeCryptoOperation.
// process with crypto helper
private void startOrResumeCryptoOperation() {
RetainFragment<MessageCryptoHelper> retainCryptoHelperFragment = getMessageCryptoHelperRetainFragment(true);
if (retainCryptoHelperFragment.hasData()) {
messageCryptoHelper = retainCryptoHelperFragment.getData();
}
if (messageCryptoHelper == null || messageCryptoHelper.isConfiguredForOutdatedCryptoProvider()) {
messageCryptoHelper = new MessageCryptoHelper(context);
retainCryptoHelperFragment.setData(messageCryptoHelper);
}
messageCryptoHelper.asyncStartOrResumeProcessingMessage(localMessage, messageCryptoCallback, cachedDecryptionResult);
}
use of com.fsck.k9.mailstore.LocalMessage in project k-9 by k9mail.
the class ReconstructMessageFromDatabaseTest method testThatByteIdenticalCopyOfMessageIsReconstructed.
public void testThatByteIdenticalCopyOfMessageIsReconstructed() throws IOException, MessagingException {
LocalFolder folder = createFolderInDatabase();
MimeMessage message = parseMessage();
saveMessageToDatabase(folder, message);
LocalMessage localMessage = readMessageFromDatabase(folder, message);
String reconstructedMessage = writeMessageToString(localMessage);
assertEquals(MESSAGE_SOURCE, reconstructedMessage);
}
use of com.fsck.k9.mailstore.LocalMessage in project k-9 by k9mail.
the class MessagingControllerTest method synchronizeMailboxSynchronous_withAccountSetToSyncRemoteDeletions_shouldNotDeleteLocalCopiesOfExistingMessagesAfterEarliestPollDate.
@Test
public void synchronizeMailboxSynchronous_withAccountSetToSyncRemoteDeletions_shouldNotDeleteLocalCopiesOfExistingMessagesAfterEarliestPollDate() throws Exception {
messageCountInRemoteFolder(1);
Date dateOfEarliestPoll = new Date();
LocalMessage localMessage = localMessageWithCopyOnServer();
when(account.syncRemoteDeletions()).thenReturn(true);
when(account.getEarliestPollDate()).thenReturn(dateOfEarliestPoll);
when(localMessage.olderThan(dateOfEarliestPoll)).thenReturn(false);
when(localFolder.getMessages(null)).thenReturn(Collections.singletonList(localMessage));
controller.synchronizeMailboxSynchronous(account, FOLDER_NAME, listener, remoteFolder);
verify(localFolder, never()).destroyMessages(messageListCaptor.capture());
}
use of com.fsck.k9.mailstore.LocalMessage in project k-9 by k9mail.
the class MessagingControllerTest method localMessageWithCopyOnServer.
private LocalMessage localMessageWithCopyOnServer() throws MessagingException {
String messageUid = "UID";
Message remoteMessage = mock(Message.class);
LocalMessage localMessage = mock(LocalMessage.class);
when(remoteMessage.getUid()).thenReturn(messageUid);
when(localMessage.getUid()).thenReturn(messageUid);
when(remoteFolder.getMessages(anyInt(), anyInt(), any(Date.class), any(MessageRetrievalListener.class))).thenReturn(Collections.singletonList(remoteMessage));
return localMessage;
}
use of com.fsck.k9.mailstore.LocalMessage in project k-9 by k9mail.
the class AttachmentController method downloadAttachment.
private void downloadAttachment(LocalPart localPart, final Runnable attachmentDownloadedCallback) {
String accountUuid = localPart.getAccountUuid();
Account account = Preferences.getPreferences(context).getAccount(accountUuid);
LocalMessage message = localPart.getMessage();
messageViewFragment.showAttachmentLoadingDialog();
controller.loadAttachment(account, message, attachment.part, new SimpleMessagingListener() {
@Override
public void loadAttachmentFinished(Account account, Message message, Part part) {
messageViewFragment.hideAttachmentLoadingDialogOnMainThread();
messageViewFragment.runOnMainThread(attachmentDownloadedCallback);
}
@Override
public void loadAttachmentFailed(Account account, Message message, Part part, String reason) {
messageViewFragment.hideAttachmentLoadingDialogOnMainThread();
}
});
}
Aggregations