use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class AttachmentInfoExtractorTest method extractInfoForDb__withDispositionSizeParam__shouldReturnThatSize.
@Test
public void extractInfoForDb__withDispositionSizeParam__shouldReturnThatSize() throws Exception {
MimeBodyPart part = new MimeBodyPart();
part.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, "attachment" + "; size=\"" + TEST_SIZE + "\"");
AttachmentViewInfo attachmentViewInfo = attachmentInfoExtractor.extractAttachmentInfoForDatabase(part);
assertEquals(TEST_SIZE, attachmentViewInfo.size);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class PreviewTextExtractorTest method extractPreview_withEmptyBody_shouldThrow.
@Test(expected = PreviewExtractionException.class)
public void extractPreview_withEmptyBody_shouldThrow() throws Exception {
Part part = new MimeBodyPart(null, "text/plain");
previewTextExtractor.extractPreview(part);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class MessageCryptoHelper method addErrorAnnotation.
private void addErrorAnnotation(Part part, CryptoError error, MimeBodyPart replacementPart) {
CryptoResultAnnotation annotation = CryptoResultAnnotation.createErrorAnnotation(error, replacementPart);
messageAnnotations.put(part, annotation);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class MessageCryptoHelper method handleCryptoOperationSuccess.
private void handleCryptoOperationSuccess(MimeBodyPart outputPart) {
OpenPgpDecryptionResult decryptionResult = currentCryptoResult.getParcelableExtra(OpenPgpApi.RESULT_DECRYPTION);
OpenPgpSignatureResult signatureResult = currentCryptoResult.getParcelableExtra(OpenPgpApi.RESULT_SIGNATURE);
PendingIntent pendingIntent = currentCryptoResult.getParcelableExtra(OpenPgpApi.RESULT_INTENT);
CryptoResultAnnotation resultAnnotation = CryptoResultAnnotation.createOpenPgpResultAnnotation(decryptionResult, signatureResult, pendingIntent, outputPart);
onCryptoOperationSuccess(resultAnnotation);
}
use of com.fsck.k9.mail.internet.MimeBodyPart in project k-9 by k9mail.
the class MessageCryptoHelper method addFoundInlinePgpParts.
private void addFoundInlinePgpParts(List<Part> foundParts) {
for (Part part : foundParts) {
if (!currentMessage.getFlags().contains(Flag.X_DOWNLOADED_FULL)) {
if (MessageDecryptVerifier.isPartPgpInlineEncrypted(part)) {
addErrorAnnotation(part, CryptoError.OPENPGP_ENCRYPTED_BUT_INCOMPLETE, NO_REPLACEMENT_PART);
} else {
MimeBodyPart replacementPart = extractClearsignedTextReplacementPart(part);
addErrorAnnotation(part, CryptoError.OPENPGP_SIGNED_BUT_INCOMPLETE, replacementPart);
}
continue;
}
CryptoPart cryptoPart = new CryptoPart(CryptoPartType.PGP_INLINE, part);
partsToDecryptOrVerify.add(cryptoPart);
}
}
Aggregations