Search in sources :

Example 31 with Callback

use of com.fsck.k9.message.MessageBuilder.Callback in project k-9 by k9mail.

the class MessageBuilderTest method build_withAttachment_longFileName.

@Test
public void build_withAttachment_longFileName() throws Exception {
    MessageBuilder messageBuilder = createSimpleMessageBuilder();
    Attachment attachment = createAttachmentWithContent("text/plain", "~~~~~~~~~1~~~~~~~~~2~~~~~~~~~3~~~~~~~~~4~~~~~~~~~5~~~~~~~~~6~~~~~~~~~7.txt", TEST_ATTACHMENT_TEXT);
    messageBuilder.setAttachments(Collections.singletonList(attachment));
    messageBuilder.buildAsync(callback);
    MimeMessage message = getMessageFromCallback();
    assertEquals(MESSAGE_HEADERS + MESSAGE_CONTENT_WITH_LONG_FILE_NAME, getMessageContents(message));
}
Also used : MimeMessage(com.fsck.k9.mail.internet.MimeMessage) RobolectricTest(com.fsck.k9.RobolectricTest) Test(org.junit.Test)

Example 32 with Callback

use of com.fsck.k9.message.MessageBuilder.Callback in project k-9 by k9mail.

the class MessageCryptoHelper method asyncStartOrResumeProcessingMessage.

public void asyncStartOrResumeProcessingMessage(Message message, MessageCryptoCallback callback, OpenPgpDecryptionResult cachedDecryptionResult, boolean processSignedOnly) {
    if (this.currentMessage != null) {
        reattachCallback(message, callback);
        return;
    }
    this.messageAnnotations = new MessageCryptoAnnotations();
    this.state = State.START;
    this.currentMessage = message;
    this.cachedDecryptionResult = cachedDecryptionResult;
    this.callback = callback;
    this.processSignedOnly = processSignedOnly;
    nextStep();
}
Also used : MessageCryptoAnnotations(com.fsck.k9.mailstore.MessageCryptoAnnotations)

Aggregations

Test (org.junit.Test)23 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)14 Callback (com.fsck.k9.message.MessageBuilder.Callback)14 MessagingException (com.fsck.k9.mail.MessagingException)11 RobolectricTest (com.fsck.k9.RobolectricTest)10 PendingIntent (android.app.PendingIntent)9 Intent (android.content.Intent)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)9 OutputStream (java.io.OutputStream)9 OpenPgpDataSource (org.openintents.openpgp.util.OpenPgpApi.OpenPgpDataSource)9 ComposeCryptoStatus (com.fsck.k9.activity.compose.ComposeCryptoStatus)7 Recipient (com.fsck.k9.view.RecipientSelectView.Recipient)5 BodyPart (com.fsck.k9.mail.BodyPart)4 MimeMultipart (com.fsck.k9.mail.internet.MimeMultipart)4 IOException (java.io.IOException)3 BinaryTempFileBody (com.fsck.k9.mail.internet.BinaryTempFileBody)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 HashMap (java.util.HashMap)2 Activity (android.app.Activity)1