From d3b67d726a25c9723d93a6aacc44be5ee8633023 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 30 Sep 1999 19:51:46 +0000 Subject: [PATCH] [unstable] fix the duplicate x-mailer/uesr-agent problem. --- sendlib.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sendlib.c b/sendlib.c index 072774abe..041d6389d 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1272,7 +1272,8 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach, { char buffer[LONG_STRING]; LIST *tmp = env->userhdrs; - + short want_xmailer = (mode == 0 && !privacy && option (OPTXMAILER)); + if (mode == 0 && !privacy) fputs (mutt_make_date (buffer, sizeof(buffer)), fp); @@ -1350,17 +1351,20 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach, mutt_write_mime_header (attach, fp); } - if (mode == 0 && !privacy && option (OPTXMAILER)) - { - /* Add a vanity header */ - fprintf (fp, "User-Agent: Mutt/%s\n", MUTT_VERSION); - } - /* Add any user defined headers */ for (; tmp; tmp = tmp->next) { fputs (tmp->data, fp); fputc ('\n', fp); + if (want_xmailer && (!strncasecmp (tmp->data, "x-mailer:", 9) || + !strncasecmp (tmp->data, "user-agent:", 11))) + want_xmailer = 0; + } + + if (want_xmailer) + { + /* Add a vanity header */ + fprintf (fp, "User-Agent: Mutt/%s\n", MUTT_VERSION); } return (ferror (fp) == 0 ? 0 : -1); -- 2.40.0