Reply to sender, not to self

pull/50/head
M66B 6 years ago
parent f25ca38376
commit 57ceca54d7

@ -36,6 +36,9 @@ public interface DaoIdentity {
@Query("SELECT * FROM identity WHERE synchronize = :synchronize")
LiveData<List<EntityIdentity>> liveIdentities(boolean synchronize);
@Query("SELECT * FROM identity")
List<EntityIdentity> getIdentities();
@Query("SELECT * FROM identity WHERE id = :id")
EntityIdentity getIdentity(long id);

@ -540,13 +540,18 @@ public class FragmentCompose extends FragmentEx {
if (ref != null) {
account = ref.account;
// Reply to sender
EntityFolder rfolder = db.folder().getFolder(ref.folder);
if (EntityFolder.SENT.equals(rfolder.type)) {
Address[] tmp = ref.to;
ref.to = ref.from;
ref.reply = null;
ref.from = tmp;
// Reply to sender, not to known self
if (ref.from != null && ref.from.length == 1) {
// All identities, synchronized or not
List<EntityIdentity> identities = db.identity().getIdentities();
for (EntityIdentity identity : identities)
if (((InternetAddress) ref.from[0]).getAddress().equals(identity.email)) {
Address[] tmp = ref.to;
ref.to = ref.from;
ref.reply = null;
ref.from = tmp;
break;
}
}
}

Loading…
Cancel
Save