From 4f4ab3a625453adb8a57a24de897cb6041c23aa4 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 1 Sep 2019 16:02:48 +0200 Subject: [PATCH] Removed FairEmail from headers --- app/src/main/java/eu/faircode/email/EntityMessage.java | 10 ++-------- app/src/main/java/eu/faircode/email/MessageHelper.java | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/EntityMessage.java b/app/src/main/java/eu/faircode/email/EntityMessage.java index 4e35c1f5fa..9922ed9715 100644 --- a/app/src/main/java/eu/faircode/email/EntityMessage.java +++ b/app/src/main/java/eu/faircode/email/EntityMessage.java @@ -37,7 +37,7 @@ import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Objects; -import java.util.Random; +import java.util.UUID; import javax.mail.Address; import javax.mail.internet.InternetAddress; @@ -157,13 +157,7 @@ public class EntityMessage implements Serializable { public Long last_attempt; // send static String generateMessageId() { - StringBuilder sb = new StringBuilder(); - sb.append('<') - .append(Math.abs(new Random().nextInt())).append('.') - .append(System.currentTimeMillis()).append('.') - .append(BuildConfig.APPLICATION_ID).append("@localhost") - .append('>'); - return sb.toString(); + return "<" + UUID.randomUUID() + "@localhost" + '>'; } boolean replySelf(String via) { diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index b160ea4ecd..ea2b5a6b41 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -121,7 +121,7 @@ public class MessageHelper { if (message.inreplyto != null) imessage.addHeader("In-Reply-To", message.inreplyto); - imessage.addHeader("X-FairEmail-ID", message.msgid); + imessage.addHeader("X-Correlation-ID", message.msgid); imessage.setFlag(Flags.Flag.SEEN, message.seen); imessage.setFlag(Flags.Flag.FLAGGED, message.flagged); @@ -405,7 +405,7 @@ public class MessageHelper { String getMessageID() throws MessagingException { // Outlook outbox -> sent - String header = imessage.getHeader("X-FairEmail-ID", null); + String header = imessage.getHeader("X-Correlation-ID", null); if (header == null) header = imessage.getHeader("Message-ID", null); return (header == null ? null : MimeUtility.unfold(header));