From 810f74441b61b6c52ea4a561f488b25800350c95 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 5 Feb 2023 10:27:58 +0100 Subject: [PATCH] Defer send MX check --- .../eu/faircode/email/FragmentCompose.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index d4bf5ac622..1c8a1036c6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -6322,14 +6322,6 @@ public class FragmentCompose extends FragmentBase { args.putString("address_error", ex.getMessage()); } - try { - checkMx(ato, context); - checkMx(acc, context); - checkMx(abcc, context); - } catch (UnknownHostException ex) { - args.putString("mx_error", ex.getMessage()); - } - if (draft.to == null && draft.cc == null && draft.bcc == null && (identity == null || (identity.cc == null && identity.bcc == null))) args.putBoolean("remind_to", true); @@ -6554,6 +6546,22 @@ public class FragmentCompose extends FragmentBase { db.endTransaction(); } + if (action == R.id.action_check) + try { + InternetAddress[] ato = MessageHelper.dedup(MessageHelper.parseAddresses(context, to)); + InternetAddress[] acc = MessageHelper.dedup(MessageHelper.parseAddresses(context, cc)); + InternetAddress[] abcc = MessageHelper.dedup(MessageHelper.parseAddresses(context, bcc)); + + try { + checkMx(ato, context); + checkMx(acc, context); + checkMx(abcc, context); + } catch (UnknownHostException ex) { + args.putString("mx_error", ex.getMessage()); + } + } catch (Throwable ignored) { + } + args.putBoolean("dirty", dirty); if (dirty) ServiceSynchronize.eval(context, "compose/action");