From 93022cc19b0adae529391b143fbae0a84764a554 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 4 Jul 2020 18:59:17 +0200 Subject: [PATCH] Filter self on not replying to self If this sounds complicated: it is! --- .../main/java/eu/faircode/email/FragmentCompose.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 7e79966c27..a949e5f146 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -3270,7 +3270,15 @@ public class FragmentCompose extends FragmentBase { // Prevent replying to self if (ref.replySelf(data.identities, ref.account)) { data.draft.from = ref.from; - data.draft.to = ref.to; + List
tos = new ArrayList<>(); + if (ref.to != null) + for (Address to : ref.to) + for (EntityIdentity identity : data.identities) + if (!Objects.equals(identity.account, ref.account) || + !identity.self || + !identity.similarAddress(to)) + tos.add(to); + data.draft.to = (tos.size() == 0 ? null : tos.toArray(new Address[0])); } else { data.draft.from = ref.to; data.draft.to = (ref.reply == null || ref.reply.length == 0 ? ref.from : ref.reply);