Match identities for sent messages

pull/146/head
M66B 6 years ago
parent 623ccaa522
commit acba8b20f9

@ -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);

Loading…
Cancel
Save