Browse Source

Reply to sender, not to self

main
M66B 6 years ago
parent
commit
57ceca54d7
2 changed files with 15 additions and 7 deletions
  1. +3
    -0
      app/src/main/java/eu/faircode/email/DaoIdentity.java
  2. +12
    -7
      app/src/main/java/eu/faircode/email/FragmentCompose.java

+ 3
- 0
app/src/main/java/eu/faircode/email/DaoIdentity.java View File

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


+ 12
- 7
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

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