/*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
* Copyright (C) 1999-2000 Thomas Roessler <roessler@guug.de>
*
* This program is free software; you can redistribute it and/or modify
newhdr->content->length = hdr->content->length;
mutt_parse_part (fp, newhdr->content);
- /* weed user-agent, x-mailer - we don't want them here */
- p = newhdr->env->userhdrs;
- q = &newhdr->env->userhdrs;
-
- while (p)
- {
- if (!ascii_strncasecmp (p->data, "x-mailer:", 9) || !ascii_strncasecmp (p->data, "user-agent:", 11))
- {
- *q = p->next;
- p->next = NULL;
- mutt_free_list (&p);
- }
- else
- q = &p->next;
-
- p = *q;
- }
-
safe_free ((void **) &newhdr->env->message_id);
safe_free ((void **) &newhdr->env->mail_followup_to); /* really? */
/*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
char buffer[LONG_STRING];
char *p;
LIST *tmp = env->userhdrs;
+ int has_agent = 0; /* user defined user-agent header field exists */
if (mode == 0 && !privacy)
fputs (mutt_make_date (buffer, sizeof(buffer)), fp);
fputc ('\n', 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)
{
p++; SKIPWS (p);
if (!*p) continue; /* don't emit empty fields. */
+ /* check to see if the user has overridden the user-agent field */
+ if (!ascii_strncasecmp ("user-agent", tmp->data, 10))
+ {
+ has_agent = 1;
+ if (privacy)
+ continue;
+ }
+
fputs (tmp->data, fp);
fputc ('\n', fp);
}
}
+ if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent)
+ {
+ /* Add a vanity header */
+ fprintf (fp, "User-Agent: Mutt/%s\n", MUTT_VERSION);
+ }
+
return (ferror (fp) == 0 ? 0 : -1);
}