1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-04 02:28:18 +00:00

Match identities for sent messages

This commit is contained in:
M66B 2018-11-11 07:09:49 +00:00
parent 623ccaa522
commit acba8b20f9

View file

@ -1870,16 +1870,18 @@ public class ServiceSynchronize extends LifecycleService {
} }
if (message == null) { if (message == null) {
Address[] tos = helper.getTo(); Address[] tos = (folder.isOutgoing() ? helper.getFrom() : helper.getTo());
EntityIdentity identity = null; EntityIdentity identity = null;
if (tos != null && tos.length > 0) { if (tos != null && tos.length > 0) {
String to = ((InternetAddress) tos[0]).getAddress(); String to = ((InternetAddress) tos[0]).getAddress();
if (!TextUtils.isEmpty(to)) { if (!TextUtils.isEmpty(to)) {
to = to.toLowerCase(); to = to.toLowerCase();
identity = db.identity().getIdentity(folder.account, to); identity = db.identity().getIdentity(folder.account, to);
if (identity == null) if (identity == null)
identity = db.identity().getIdentity(folder.account, Helper.canonicalAddress(to)); identity = db.identity().getIdentity(folder.account, Helper.canonicalAddress(to));
if (identity == null) {
if (identity == null && !folder.isOutgoing()) {
to = helper.getDeliveredTo(); to = helper.getDeliveredTo();
if (!TextUtils.isEmpty(to)) if (!TextUtils.isEmpty(to))
identity = db.identity().getIdentity(folder.account, to); identity = db.identity().getIdentity(folder.account, to);