From 9ce0b9a6016fd18075f127a85bdc0882e92444f5 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 17 May 2023 23:30:40 +0200 Subject: [PATCH] Prevent duplicate cc address --- .../eu/faircode/email/FragmentCompose.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 01484aa46d..9c95cd660d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -5429,9 +5429,21 @@ public class FragmentCompose extends FragmentBase { EntityLog.log(context, "Recognized=null"); } - if ("reply_all".equals(action)) - data.draft.cc = ref.getAllRecipients(data.identities, ref.account); - else if ("dsn".equals(action)) { + if ("reply_all".equals(action)) { + List
all = new ArrayList<>(); + for (Address recipient : ref.getAllRecipients(data.identities, ref.account)) { + boolean found = false; + if (data.draft.to != null) + for (Address t : data.draft.to) + if (MessageHelper.equalEmail(recipient, t)) { + found = true; + break; + } + if (!found) + all.add(recipient); + } + data.draft.cc = all.toArray(new Address[0]); + } else if ("dsn".equals(action)) { data.draft.dsn = dsn; data.draft.receipt_request = false; }