From 4586444c93cc3634d2ab1f960c780c5a6dd2f42a Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Mon, 8 Jul 2019 15:23:44 -0700 Subject: [PATCH] Factor out mutt_edit_address() in send.c. For reuse by autocrypt for address prompts. --- protos.h | 1 + send.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/protos.h b/protos.h index 02829bf2..453dde6d 100644 --- a/protos.h +++ b/protos.h @@ -315,6 +315,7 @@ int mutt_decode_save_attachment (FILE *, BODY *, const char *, int, int); int mutt_display_message (HEADER *h); int mutt_dump_variables (void); int mutt_edit_attachment(BODY *); +int mutt_edit_address (ADDRESS **, const char *, int); int mutt_edit_message (CONTEXT *, HEADER *); int mutt_fetch_recips (ENVELOPE *out, ENVELOPE *in, int flags); int mutt_chscmp (const char *s, const char *chs); diff --git a/send.c b/send.c index d45141c3..0cb6cf18 100644 --- a/send.c +++ b/send.c @@ -190,7 +190,7 @@ static ADDRESS *find_mailing_lists (ADDRESS *t, ADDRESS *c) return top; } -static int edit_address (ADDRESS **a, /* const */ char *field) +int mutt_edit_address (ADDRESS **a, const char *field, int expand_aliases) { char buf[HUGE_STRING]; char *err = NULL; @@ -204,7 +204,9 @@ static int edit_address (ADDRESS **a, /* const */ char *field) if (mutt_get_field (field, buf, sizeof (buf), MUTT_ALIAS) != 0) return (-1); rfc822_free_address (a); - *a = mutt_expand_aliases (mutt_parse_adrlist (NULL, buf)); + *a = mutt_parse_adrlist (NULL, buf); + if (expand_aliases) + *a = mutt_expand_aliases (*a); if ((idna_ok = mutt_addrlist_to_intl (*a, &err)) != 0) { mutt_error (_("Error: '%s' is a bad IDN."), err); @@ -222,11 +224,11 @@ static int edit_envelope (ENVELOPE *en) char buf[HUGE_STRING]; LIST *uh = UserHeader; - if (edit_address (&en->to, _("To: ")) == -1 || en->to == NULL) + if (mutt_edit_address (&en->to, _("To: "), 1) == -1 || en->to == NULL) return (-1); - if (option (OPTASKCC) && edit_address (&en->cc, _("Cc: ")) == -1) + if (option (OPTASKCC) && mutt_edit_address (&en->cc, _("Cc: "), 1) == -1) return (-1); - if (option (OPTASKBCC) && edit_address (&en->bcc, _("Bcc: ")) == -1) + if (option (OPTASKBCC) && mutt_edit_address (&en->bcc, _("Bcc: "), 1) == -1) return (-1); if (en->subject) -- 2.40.0