summaryrefslogtreecommitdiffstats
path: root/sendlib.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-09-30 19:51:46 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-09-30 19:51:46 +0000
commit02164535a7db6c975e07657e55657d8f7a39e86e (patch)
tree63d729ca057746f59f1fa548869937fa2aef6179 /sendlib.c
parent38a4991acb1455c51cbe8f32aeda324dea657979 (diff)
[unstable] fix the duplicate x-mailer/uesr-agent problem.
Diffstat (limited to 'sendlib.c')
-rw-r--r--sendlib.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sendlib.c b/sendlib.c
index 072774ab..041d6389 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);