Mark messages as modified

pull/215/head
M66B 3 months ago
parent 58cf914d87
commit efb70728f2

@ -2214,6 +2214,7 @@ class Core {
: message.references + " " + message.msgid);
MimeMessage icopy = new MimeMessageEx((MimeMessage) imessage, msgid);
icopy.addHeader("References", MessageHelper.limitReferences(ref));
icopy.addHeader(MessageHelper.HEADER_MODIFIED_TIME, Long.toString(new Date().getTime()));
MessageHelper helper = new MessageHelper(icopy, context);
MessageHelper.MessageParts parts = helper.getMessageParts();
List<MessageHelper.AttachmentPart> aparts = parts.getAttachmentParts();
@ -3244,6 +3245,7 @@ class Core {
MimeMessage icopy = new MimeMessageEx((MimeMessage) imessage, msgid);
icopy.setSubject(subject); // Update or delete subject
icopy.addHeader("References", MessageHelper.limitReferences(ref));
icopy.addHeader(MessageHelper.HEADER_MODIFIED_TIME, Long.toString(new Date().getTime()));
ifolder.appendMessages(new Message[]{icopy});
@ -4643,7 +4645,7 @@ class Core {
Long received;
long future = new Date().getTime() + FUTURE_RECEIVED;
if (account.use_date || EntityFolder.SENT.equals(folder.type)) {
if (account.use_date || EntityFolder.SENT.equals(folder.type) || helper.isModified()) {
received = sent;
if (received == null || received == 0 || received > future)
received = helper.getReceived();

@ -180,6 +180,7 @@ public class MessageHelper {
static final String HEADER_CORRELATION_ID = "X-Correlation-ID";
static final String HEADER_MICROSOFT_ORIGINAL_MESSAGE_ID = "X-Microsoft-Original-Message-ID";
static final String HEADER_GOOGLE_ORIGINAL_MESSAGE_ID = "X-Google-Original-Message-ID";
static final String HEADER_MODIFIED_TIME = "X-Modified-Time";
static final int MAX_SUBJECT_AGE = 48; // hours
static final int DEFAULT_THREAD_RANGE = 7; // 2^7 = 128 days
static final int MAX_UNZIP_COUNT = 20;
@ -3040,6 +3041,11 @@ public class MessageHelper {
return (size < 0 ? null : size);
}
boolean isModified() throws MessagingException {
ensureHeaders();
return (imessage.getHeader(HEADER_MODIFIED_TIME) != null);
}
Long getReceived() throws MessagingException {
ensureEnvelope();

Loading…
Cancel
Save