Moved bodies up

This commit is contained in:
dankito 2024-11-28 01:51:49 +01:00
parent 0a53966b16
commit 922fa629ae
2 changed files with 9 additions and 4 deletions

View File

@ -159,11 +159,15 @@ open class EmailsFetcher(
val email = Email(
status.folder.getUID(message),
sender, message.subject ?: "", map(message.sentDate ?: message.receivedDate),
message.getRecipients(Message.RecipientType.TO).orEmpty().map { map(it) }, message.getRecipients(Message.RecipientType.CC).orEmpty().map { map(it) }, message.getRecipients(Message.RecipientType.BCC).orEmpty().map { map(it) },
(message.replyTo?.firstOrNull() as? InternetAddress)?.let { if (it.address != sender?.address) map(it) else null }, // only set replyTo if it differs from sender
parts.any { it.mediaType == "application/pgp-encrypted" },
imapMessage?.contentLanguage?.firstOrNull(),
plainTextBody, getHtmlBody(messageBodyParts, status, plainTextBody),
imapMessage?.contentLanguage?.firstOrNull(),
parts.any { it.mediaType == "application/pgp-encrypted" },
attachments
)

View File

@ -24,11 +24,12 @@ class Email(
val bcc: List<EmailAddress> = emptyList(),
val replayTo: EmailAddress? = null,
val isEncrypted: Boolean = false,
val contentLanguage: String? = null,
val plainTextBody: String? = null,
val htmlBody: String? = null,
val contentLanguage: String? = null,
val isEncrypted: Boolean = false,
val attachments: List<EmailAttachment> = emptyList()
) {
val plainTextOrHtmlBody: String? by lazy { plainTextBody ?: htmlBody }