mirror of https://github.com/M66B/FairEmail.git
Check multiparts
This commit is contained in:
parent
f3cc91fb65
commit
41ef956695
|
@ -2372,57 +2372,65 @@ public class MessageHelper {
|
|||
if ("application/pgp-signature".equals(protocol) ||
|
||||
"application/pkcs7-signature".equals(protocol) ||
|
||||
"application/x-pkcs7-signature".equals(protocol)) {
|
||||
Multipart multipart = (Multipart) part.getContent();
|
||||
if (multipart.getCount() == 2) {
|
||||
getMessageParts(multipart.getBodyPart(0), parts, null);
|
||||
getMessageParts(multipart.getBodyPart(1), parts,
|
||||
"application/pgp-signature".equals(protocol)
|
||||
? EntityAttachment.PGP_SIGNATURE
|
||||
: EntityAttachment.SMIME_SIGNATURE);
|
||||
Object content = part.getContent();
|
||||
if (content instanceof Multipart) {
|
||||
Multipart multipart = (Multipart) content;
|
||||
if (multipart.getCount() == 2) {
|
||||
getMessageParts(multipart.getBodyPart(0), parts, null);
|
||||
getMessageParts(multipart.getBodyPart(1), parts,
|
||||
"application/pgp-signature".equals(protocol)
|
||||
? EntityAttachment.PGP_SIGNATURE
|
||||
: EntityAttachment.SMIME_SIGNATURE);
|
||||
|
||||
AttachmentPart apart = new AttachmentPart();
|
||||
apart.disposition = Part.INLINE;
|
||||
apart.filename = "content.asc";
|
||||
apart.encrypt = "application/pgp-signature".equals(protocol)
|
||||
? EntityAttachment.PGP_CONTENT
|
||||
: EntityAttachment.SMIME_CONTENT;
|
||||
apart.part = part;
|
||||
AttachmentPart apart = new AttachmentPart();
|
||||
apart.disposition = Part.INLINE;
|
||||
apart.filename = "content.asc";
|
||||
apart.encrypt = "application/pgp-signature".equals(protocol)
|
||||
? EntityAttachment.PGP_CONTENT
|
||||
: EntityAttachment.SMIME_CONTENT;
|
||||
apart.part = part;
|
||||
|
||||
apart.attachment = new EntityAttachment();
|
||||
apart.attachment.disposition = apart.disposition;
|
||||
apart.attachment.name = apart.filename;
|
||||
apart.attachment.type = "text/plain";
|
||||
apart.attachment.size = getSize();
|
||||
apart.attachment.encryption = apart.encrypt;
|
||||
apart.attachment = new EntityAttachment();
|
||||
apart.attachment.disposition = apart.disposition;
|
||||
apart.attachment.name = apart.filename;
|
||||
apart.attachment.type = "text/plain";
|
||||
apart.attachment.size = getSize();
|
||||
apart.attachment.encryption = apart.encrypt;
|
||||
|
||||
parts.attachments.add(apart);
|
||||
parts.attachments.add(apart);
|
||||
|
||||
return parts;
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(ct);
|
||||
for (int i = 0; i < multipart.getCount(); i++)
|
||||
sb.append(' ').append(i).append('=').append(multipart.getBodyPart(i).getContentType());
|
||||
Log.e(sb.toString());
|
||||
}
|
||||
return parts;
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(ct);
|
||||
for (int i = 0; i < multipart.getCount(); i++)
|
||||
sb.append(' ').append(i).append('=').append(multipart.getBodyPart(i).getContentType());
|
||||
Log.e(sb.toString());
|
||||
}
|
||||
} else
|
||||
throw new MessagingException("Multipart=" + (content == null ? null : content.getClass().getName()));
|
||||
} else
|
||||
Log.e(ct.toString());
|
||||
} else if (part.isMimeType("multipart/encrypted")) {
|
||||
ContentType ct = new ContentType(part.getContentType());
|
||||
String protocol = ct.getParameter("protocol");
|
||||
if ("application/pgp-encrypted".equals(protocol) || protocol == null) {
|
||||
Multipart multipart = (Multipart) part.getContent();
|
||||
if (multipart.getCount() == 2) {
|
||||
// Ignore header
|
||||
getMessageParts(multipart.getBodyPart(1), parts, EntityAttachment.PGP_MESSAGE);
|
||||
return parts;
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(ct);
|
||||
for (int i = 0; i < multipart.getCount(); i++)
|
||||
sb.append(' ').append(i).append('=').append(multipart.getBodyPart(i).getContentType());
|
||||
Log.e(sb.toString());
|
||||
}
|
||||
Object content = part.getContent();
|
||||
if (content instanceof Multipart) {
|
||||
Multipart multipart = (Multipart) content;
|
||||
if (multipart.getCount() == 2) {
|
||||
// Ignore header
|
||||
getMessageParts(multipart.getBodyPart(1), parts, EntityAttachment.PGP_MESSAGE);
|
||||
return parts;
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(ct);
|
||||
for (int i = 0; i < multipart.getCount(); i++)
|
||||
sb.append(' ').append(i).append('=').append(multipart.getBodyPart(i).getContentType());
|
||||
Log.e(sb.toString());
|
||||
}
|
||||
} else
|
||||
throw new MessagingException("Multipart=" + (content == null ? null : content.getClass().getName()));
|
||||
} else
|
||||
Log.e(ct.toString());
|
||||
} else if (part.isMimeType("application/pkcs7-mime") ||
|
||||
|
|
Loading…
Reference in New Issue