Fixed me check

This commit is contained in:
M66B 2019-04-24 12:17:32 +02:00
parent 856d04d79e
commit b19dd4f9bb
1 changed files with 19 additions and 18 deletions

View File

@ -1368,25 +1368,26 @@ class Core {
Address[] recipients = (type == EntityContact.TYPE_TO Address[] recipients = (type == EntityContact.TYPE_TO
? message.to ? message.to
: (message.reply != null ? message.reply : message.from)); : (message.reply != null ? message.reply : message.from));
if (recipients != null) {
// Check if from self
if (type == EntityContact.TYPE_FROM) {
boolean me = true;
for (Address reply : recipients) {
String email = ((InternetAddress) reply).getAddress();
String canonical = Helper.canonicalAddress(email);
if (!TextUtils.isEmpty(email) &&
db.identity().getIdentity(folder.account, email) == null &&
(canonical.equals(email) ||
db.identity().getIdentity(folder.account, canonical) == null)) {
me = false;
break;
}
}
if (me)
recipients = message.to;
}
// Check if from self
if (type == EntityContact.TYPE_FROM && recipients != null && recipients.length > 0) {
boolean me = true;
for (Address reply : recipients) {
String email = ((InternetAddress) reply).getAddress();
String canonical = Helper.canonicalAddress(email);
if (!TextUtils.isEmpty(email) &&
db.identity().getIdentity(folder.account, email) == null &&
(canonical.equals(email) ||
db.identity().getIdentity(folder.account, canonical) == null)) {
me = false;
break;
}
}
if (me)
recipients = message.to;
}
if (recipients != null) {
for (Address recipient : recipients) { for (Address recipient : recipients) {
String email = ((InternetAddress) recipient).getAddress(); String email = ((InternetAddress) recipient).getAddress();
String name = ((InternetAddress) recipient).getPersonal(); String name = ((InternetAddress) recipient).getPersonal();