Match delivered-to as last

pull/190/head
M66B 4 years ago
parent 47c070d543
commit 4c20128715

@ -1318,6 +1318,7 @@ Note that this is independent of receiving messages.
Identities are as expected matched by account.
For incoming messages the *to*, *cc*, *bcc*, *from* and *(X-)delivered/envelope/original-to* addresses will be checked (in this order)
and for outgoing messages (drafts, outbox and sent) only the *from* addresses will be checked.
Equal addresses have precedence over partially matching addresses, except for *delivered-to* addresses.
The matched address will be shown as *via* in the addresses section of received messages (between the message header and message text).

@ -3113,14 +3113,16 @@ class Core {
addresses.addAll(Arrays.asList(message.bcc));
if (message.from != null)
addresses.addAll(Arrays.asList(message.from));
if (message.deliveredto != null)
try {
addresses.add(new InternetAddress(message.deliveredto));
} catch (AddressException ex) {
Log.w(ex);
}
}
InternetAddress deliveredto = null;
if (message.deliveredto != null)
try {
deliveredto = new InternetAddress(message.deliveredto);
} catch (AddressException ex) {
Log.w(ex);
}
// Search for matching identity
List<EntityIdentity> identities = db.identity().getSynchronizingIdentities(folder.account);
if (identities != null) {
@ -3133,6 +3135,11 @@ class Core {
for (EntityIdentity identity : identities)
if (identity.similarAddress(address))
return identity;
if (deliveredto != null)
for (EntityIdentity identity : identities)
if (identity.sameAddress(deliveredto) || identity.similarAddress(deliveredto))
return identity;
}
return null;

Loading…
Cancel
Save