From 4e222ec6d1c7b5f1fd75a18fb83e5fe0626fc53b Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 1 Sep 2018 06:11:36 +0000 Subject: [PATCH] Fixed replying to self --- .../eu/faircode/email/FragmentCompose.java | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index f6cb3c4788..9d02b6a081 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -746,18 +746,23 @@ public class FragmentCompose extends FragmentEx { account = ref.account; // Reply to sender, not to known self - if (ref.from != null && ref.from.length == 1) { - // All identities, synchronized or not - List 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; - } - } + String from = (ref.from == null || ref.from.length == 0 ? null : ((InternetAddress) ref.from[0]).getAddress()); + String replyto = (ref.reply == null || ref.reply.length == 0 ? null : ((InternetAddress) ref.reply[0]).getAddress()); + List identities = db.identity().getIdentities(); + for (EntityIdentity identity : identities) + if (from != null && from.equals(identity.email)) { + Address[] tmp = ref.to; + ref.to = ref.from; + ref.reply = null; + ref.from = tmp; + break; + } else if (replyto != null && replyto.equals(identity.email)) { + Address[] tmp = ref.reply; + ref.to = ref.from; + ref.reply = null; + ref.from = tmp; + break; + } } EntityFolder drafts;