use available methods for structure detection

This commit is contained in:
Vincent Breitmoser 2017-09-19 00:21:45 +02:00
parent 57a5d96173
commit ac628a265d
2 changed files with 4 additions and 5 deletions

View file

@ -233,7 +233,7 @@ public class MessageCryptoStructureDetector {
return dataUnavailable || protocolMatches; return dataUnavailable || protocolMatches;
} }
private static boolean isPartMultipartEncrypted(Part part) { public static boolean isPartMultipartEncrypted(Part part) {
if (!isSameMimeType(part.getMimeType(), MULTIPART_ENCRYPTED)) { if (!isSameMimeType(part.getMimeType(), MULTIPART_ENCRYPTED)) {
return false; return false;
} }

View file

@ -83,10 +83,9 @@ public class MessageViewInfoExtractor {
return extractSimpleMessageForView(message, message); return extractSimpleMessageForView(message, message);
} }
boolean isOpenPgpEncrypted = boolean isOpenPgpEncrypted = (MessageCryptoStructureDetector.isPartMultipartEncrypted(cryptoContentPart) &&
MimeUtility.isSameMimeType(cryptoContentPart.getMimeType(), "multipart/encrypted") && MessageCryptoStructureDetector.isMultipartEncryptedOpenPgpProtocol(cryptoContentPart)) ||
MimeUtility.isSameMimeType(getHeaderParameter(cryptoContentPart.getContentType(), "protocol"), MessageCryptoStructureDetector.isPartPgpInlineEncrypted(cryptoContentPart);
"application/pgp-encrypted");
if (!K9.isOpenPgpProviderConfigured() && isOpenPgpEncrypted) { if (!K9.isOpenPgpProviderConfigured() && isOpenPgpEncrypted) {
CryptoResultAnnotation noProviderAnnotation = CryptoResultAnnotation.createErrorAnnotation( CryptoResultAnnotation noProviderAnnotation = CryptoResultAnnotation.createErrorAnnotation(
CryptoError.OPENPGP_ENCRYPTED_NO_PROVIDER, null); CryptoError.OPENPGP_ENCRYPTED_NO_PROVIDER, null);