Up prioritized messageId and added documentation for it
This commit is contained in:
parent
110da9ced6
commit
0a53966b16
|
@ -157,10 +157,10 @@ open class EmailsFetcher(
|
||||||
val plainTextBody = getPlainTextBody(messageBodyParts, status)
|
val plainTextBody = getPlainTextBody(messageBodyParts, status)
|
||||||
|
|
||||||
val email = Email(
|
val email = Email(
|
||||||
|
status.folder.getUID(message),
|
||||||
sender, message.subject ?: "", map(message.sentDate ?: message.receivedDate),
|
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.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
|
(message.replyTo?.firstOrNull() as? InternetAddress)?.let { if (it.address != sender?.address) map(it) else null }, // only set replyTo if it differs from sender
|
||||||
status.folder.getUID(message),
|
|
||||||
parts.any { it.mediaType == "application/pgp-encrypted" },
|
parts.any { it.mediaType == "application/pgp-encrypted" },
|
||||||
imapMessage?.contentLanguage?.firstOrNull(),
|
imapMessage?.contentLanguage?.firstOrNull(),
|
||||||
plainTextBody, getHtmlBody(messageBodyParts, status, plainTextBody),
|
plainTextBody, getHtmlBody(messageBodyParts, status, plainTextBody),
|
||||||
|
|
|
@ -4,18 +4,31 @@ import java.time.Instant
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
|
|
||||||
class Email(
|
class Email(
|
||||||
|
/**
|
||||||
|
* Unique identifier of the message, used as identifier to retrieve further data of this message or as identifier
|
||||||
|
* of the last downloaded message (to continue fetching emails at messages newer than the message with this id).
|
||||||
|
*
|
||||||
|
* Actually the IMAP UID, but the user should not care which ID this value refers to.
|
||||||
|
* (messageUID: Unique identifier of a message in an email account. Survives e.g. expunging and moving the message to a different folder. This value.
|
||||||
|
* messageNumber: Non stable number. Message numbers e.g. change on expunge.
|
||||||
|
* messageId: Long string that is reference in inReplyTo field to identify to which message this message is a response of. Not of interest for us.
|
||||||
|
*/
|
||||||
|
val messageId: Long,
|
||||||
|
|
||||||
val sender: EmailAddress?,
|
val sender: EmailAddress?,
|
||||||
val subject: String,
|
val subject: String,
|
||||||
val date: Instant,
|
val date: Instant,
|
||||||
|
|
||||||
val to: List<EmailAddress>,
|
val to: List<EmailAddress>,
|
||||||
val cc: List<EmailAddress> = emptyList(),
|
val cc: List<EmailAddress> = emptyList(),
|
||||||
val bcc: List<EmailAddress> = emptyList(),
|
val bcc: List<EmailAddress> = emptyList(),
|
||||||
val replayTo: EmailAddress? = null,
|
val replayTo: EmailAddress? = null,
|
||||||
val messageId: Long,
|
|
||||||
val isEncrypted: Boolean = false,
|
val isEncrypted: Boolean = false,
|
||||||
val contentLanguage: String? = null,
|
val contentLanguage: String? = null,
|
||||||
val plainTextBody: String? = null,
|
val plainTextBody: String? = null,
|
||||||
val htmlBody: String? = null,
|
val htmlBody: String? = null,
|
||||||
|
|
||||||
val attachments: List<EmailAttachment> = emptyList()
|
val attachments: List<EmailAttachment> = emptyList()
|
||||||
) {
|
) {
|
||||||
val plainTextOrHtmlBody: String? by lazy { plainTextBody ?: htmlBody }
|
val plainTextOrHtmlBody: String? by lazy { plainTextBody ?: htmlBody }
|
||||||
|
|
Loading…
Reference in New Issue