From 96e9930e1c1de693ec945981a644134c418b1c6c Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 27 Apr 2019 16:04:39 +0200 Subject: [PATCH] Revert "Use delivered to header for identity matching" This reverts commit 842cab974e9701c9a38a84f03c118df16cf5ef1c. --- FAQ.md | 2 +- app/src/main/java/eu/faircode/email/Core.java | 11 +---------- .../main/java/eu/faircode/email/MessageHelper.java | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/FAQ.md b/FAQ.md index 6b06acc979..9240ad1234 100644 --- a/FAQ.md +++ b/FAQ.md @@ -704,7 +704,7 @@ Note that this is independent of receiving messages. **(34) How are identities matched?** Identities are as expected matched by account. -For incoming messages the (delivered) *to* and *cc* address will be checked and for outgoing messages the *from* addresses will be checked. +For incoming messages the *to* and *cc* address will be checked and for outgoing messages the *from* addresses will be checked. Archived messages will be considered as incoming messages, but additionally the *from* address will be checked. The matched address will be shown as *via* in the addresses section. diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index ebcd2c3035..4ddd5cc4d2 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -75,7 +75,6 @@ import javax.mail.Session; import javax.mail.Store; import javax.mail.StoreClosedException; import javax.mail.UIDFolder; -import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.search.ComparisonTerm; @@ -1144,7 +1143,6 @@ class Core { } if (message == null) { - String deliveredto = helper.getDeliveredTo(); Address[] froms = helper.getFrom(); Address[] tos = helper.getTo(); Address[] ccs = helper.getCc(); @@ -1155,13 +1153,6 @@ class Core { if (froms != null) addresses.addAll(Arrays.asList(froms)); } else { - if (deliveredto != null) - try { - for (Address address : InternetAddress.parse(deliveredto)) - addresses.add(address); - } catch (AddressException ex) { - Log.w(ex); - } if (tos != null) addresses.addAll(Arrays.asList(tos)); if (ccs != null) @@ -1204,7 +1195,7 @@ class Core { message.references = TextUtils.join(" ", helper.getReferences()); message.inreplyto = helper.getInReplyTo(); // Local address contains control or whitespace in string ``mailing list someone@example.org'' - message.deliveredto = deliveredto; + message.deliveredto = helper.getDeliveredTo(); message.thread = helper.getThreadId(context, account.id, uid); message.receipt_request = helper.getReceiptRequested(); message.receipt_to = helper.getReceiptTo(); diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 90b0851b1e..930fdf0f01 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -449,10 +449,7 @@ public class MessageHelper { } String getDeliveredTo() throws MessagingException { - String header = imessage.getHeader("Delivered-To", null); - if (header == null) - header = imessage.getHeader("X-Delivered-To", null); - return header; + return imessage.getHeader("Delivered-To", imessage.getHeader("X-Delivered-To", null)); } String getInReplyTo() throws MessagingException {