From 8dfd5c1676aa04b1ef4461977b9e7d007325bded Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 30 Sep 1999 22:05:24 +0000 Subject: [PATCH] Add a resend-message function (similar to the _old_ edit-message), and redo large parts of mutt_prepare_edit_message (now mutt_prepare_template). --- OPS | 1 + buffy.c | 2 +- curs_main.c | 20 ++++++ functions.h | 2 + headers.c | 2 +- imap/message.c | 4 +- main.c | 2 +- mbox.c | 4 +- mh.c | 2 +- mutt.h | 1 + parse.c | 19 ++++-- parse.h | 2 +- postpone.c | 178 ++++++++++++++++++++++++++++++++----------------- protos.h | 4 +- recvattach.c | 2 +- send.c | 23 ++++--- sendlib.c | 18 ++--- 17 files changed, 187 insertions(+), 99 deletions(-) diff --git a/OPS b/OPS index 3b738b052..f9821e97c 100644 --- a/OPS +++ b/OPS @@ -132,6 +132,7 @@ OP_RECALL_MESSAGE "recall a postponed message" OP_REDRAW "clear and redraw the screen" OP_REFORMAT_WINCH "{internal}" OP_REPLY "reply to a message" +OP_RESEND "use the current message as a template for a new one" OP_SAVE "save message/attachment to a file" OP_SEARCH "search for a regular expression" OP_SEARCH_REVERSE "search backwards for a regular expression" diff --git a/buffy.c b/buffy.c index 4bffa3236..ab9e870fe 100644 --- a/buffy.c +++ b/buffy.c @@ -99,7 +99,7 @@ int test_last_status_new (FILE * f) return (0); hdr = mutt_new_header (); - mutt_read_rfc822_header (f, hdr, 0); + mutt_read_rfc822_header (f, hdr, 0, 0); if (!(hdr->read || hdr->old)) result = 1; mutt_free_header (&hdr); diff --git a/curs_main.c b/curs_main.c index 592303313..d0c995879 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1666,6 +1666,26 @@ int mutt_index_menu (void) menu->redraw = REDRAW_FULL; break; + case OP_RESEND: + + CHECK_ATTACH; + CHECK_MSGCOUNT; + + if (tag) + { + for (j = 0; j < Context->vcount; j++) + { + if (Context->hdrs[Context->v2r[j]]->tagged) + ci_send_message (SENDRESEND, NULL, NULL, Context, + Context->hdrs[Context->v2r[j]]); + } + } + else + ci_send_message (SENDRESEND, NULL, NULL, Context, CURHDR); + + menu->redraw = REDRAW_FULL; + break; + case OP_REPLY: CHECK_ATTACH; diff --git a/functions.h b/functions.h index 2056deac0..92c439e64 100644 --- a/functions.h +++ b/functions.h @@ -106,6 +106,7 @@ struct binding_t OpMain[] = { { "recall-message", OP_RECALL_MESSAGE, "R" }, { "read-thread", OP_MAIN_READ_THREAD, "\022" }, { "read-subthread", OP_MAIN_READ_SUBTHREAD, "\033r" }, + { "resend-message", OP_RESEND, "\033e" }, { "save-message", OP_SAVE, "s" }, { "tag-pattern", OP_MAIN_TAG_PATTERN, "T" }, { "tag-subthread", OP_TAG_SUBTHREAD, NULL }, @@ -178,6 +179,7 @@ struct binding_t OpPager[] = { { "recall-message", OP_RECALL_MESSAGE, "R" }, { "read-thread", OP_MAIN_READ_THREAD, "\022" }, { "read-subthread", OP_MAIN_READ_SUBTHREAD, "\033r" }, + { "resend-message", OP_RESEND, "\033e" }, { "save-message", OP_SAVE, "s" }, { "skip-quoted", OP_PAGER_SKIP_QUOTED, "S" }, { "decode-save", OP_DECODE_SAVE, "\033s" }, diff --git a/headers.c b/headers.c index 68a5813ae..3d12c0aa3 100644 --- a/headers.c +++ b/headers.c @@ -88,7 +88,7 @@ void mutt_edit_headers (const char *editor, /* Read the temp file back in */ ifp = fopen (path, "r"); ofp = safe_fopen (body, "w"); - n = mutt_read_rfc822_header (ifp, NULL, 1); + n = mutt_read_rfc822_header (ifp, NULL, 1, 0); while ((i = fread (buffer, 1, sizeof (buffer), ifp)) > 0) fwrite (buffer, 1, i, ofp); fclose (ofp); diff --git a/imap/message.c b/imap/message.c index 6772539e2..f76fdefa9 100644 --- a/imap/message.c +++ b/imap/message.c @@ -200,7 +200,7 @@ int imap_read_headers (CONTEXT *ctx, int msgbegin, int msgend) ctx->hdrs[ctx->msgcount] = mutt_new_header (); ctx->hdrs[ctx->msgcount]->index = ctx->msgcount; - ctx->hdrs[msgno]->env = mutt_read_rfc822_header (fp, ctx->hdrs[msgno], 0); + ctx->hdrs[msgno]->env = mutt_read_rfc822_header (fp, ctx->hdrs[msgno], 0, 0); ploc=ftell(fp); ctx->hdrs[msgno]->read = h->read; ctx->hdrs[msgno]->old = h->old; @@ -367,7 +367,7 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) */ rewind (msg->fp); mutt_free_envelope (&ctx->hdrs[msgno]->env); - ctx->hdrs[msgno]->env = mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno],0); + ctx->hdrs[msgno]->env = mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno],0, 0); fgets (buf, sizeof (buf), msg->fp); while (!feof (msg->fp)) { diff --git a/main.c b/main.c index 7fd6e8199..1a86c58b3 100644 --- a/main.c +++ b/main.c @@ -609,7 +609,7 @@ int main (int argc, char **argv) tempfile = safe_strdup (buf); if (draftFile) - msg->env = mutt_read_rfc822_header (fin, NULL, 1); + msg->env = mutt_read_rfc822_header (fin, NULL, 1, 0); if (tempfile) { diff --git a/mbox.c b/mbox.c index 9d274eb77..a715c191c 100644 --- a/mbox.c +++ b/mbox.c @@ -147,7 +147,7 @@ int mmdf_parse_mailbox (CONTEXT *ctx) else hdr->received = t - tz; - hdr->env = mutt_read_rfc822_header (ctx->fp, hdr, 0); + hdr->env = mutt_read_rfc822_header (ctx->fp, hdr, 0, 0); loc = ftell (ctx->fp); @@ -285,7 +285,7 @@ int mbox_parse_mailbox (CONTEXT *ctx) curhdr->offset = loc; curhdr->index = ctx->msgcount; - curhdr->env = mutt_read_rfc822_header (ctx->fp, curhdr, 0); + curhdr->env = mutt_read_rfc822_header (ctx->fp, curhdr, 0, 0); /* if we know how long this message is, either just skip over the body, * or if we don't know how many lines there are, count them now (this will diff --git a/mh.c b/mh.c index 8cb085032..8c7c0fc36 100644 --- a/mh.c +++ b/mh.c @@ -139,7 +139,7 @@ static HEADER *maildir_parse_message(int magic, const char *fname, int is_old) if ((f = fopen (fname, "r")) != NULL) { h = mutt_new_header(); - h->env = mutt_read_rfc822_header (f, h, 0); + h->env = mutt_read_rfc822_header (f, h, 0, 0); fstat (fileno (f), &st); fclose (f); diff --git a/mutt.h b/mutt.h index 508b1f476..39f39c5d4 100644 --- a/mutt.h +++ b/mutt.h @@ -257,6 +257,7 @@ enum #define SENDBATCH (1<<5) #define SENDMAILX (1<<6) #define SENDKEY (1<<7) +#define SENDRESEND (1<<8) /* boolean vars */ enum diff --git a/parse.c b/parse.c index d4fb737ca..e3edc4d75 100644 --- a/parse.c +++ b/parse.c @@ -476,7 +476,7 @@ BODY *mutt_parse_messageRFC822 (FILE *fp, BODY *parent) parent->hdr = mutt_new_header (); parent->hdr->offset = ftell (fp); - parent->hdr->env = mutt_read_rfc822_header (fp, parent->hdr, 0); + parent->hdr->env = mutt_read_rfc822_header (fp, parent->hdr, 0, 0); msg = parent->hdr->content; /* ignore the length given in the content-length since it could be wrong @@ -858,11 +858,16 @@ void mutt_parse_mime_message (CONTEXT *ctx, HEADER *cur) * * hdr header structure of current message (optional). * - * user_hdrs If set, store user headers. Used for edit-message and + * user_hdrs If set, store user headers. Used for recall-message and * postpone modes. * + * weed If this parameter is set and the user has activated the + * $weed option, honor the header weed list for user headers. + * Used for recall-message. + * */ -ENVELOPE *mutt_read_rfc822_header (FILE *f, HEADER *hdr, short user_hdrs) +ENVELOPE *mutt_read_rfc822_header (FILE *f, HEADER *hdr, short user_hdrs, + short weed) { ENVELOPE *e = mutt_new_envelope(); LIST *last = NULL; @@ -1183,6 +1188,13 @@ ENVELOPE *mutt_read_rfc822_header (FILE *f, HEADER *hdr, short user_hdrs) /* Keep track of the user-defined headers */ if (!matched && user_hdrs) { + /* restore the original line */ + line[strlen (line)] = ':'; + + if (weed && option (OPTWEED) && mutt_matches_ignore (line, Ignore) + && !mutt_matches_ignore (line, UnIgnore)) + continue; + if (last) { last->next = mutt_new_list (); @@ -1190,7 +1202,6 @@ ENVELOPE *mutt_read_rfc822_header (FILE *f, HEADER *hdr, short user_hdrs) } else last = e->userhdrs = mutt_new_list (); - line[strlen (line)] = ':'; last->data = safe_strdup (line); } diff --git a/parse.h b/parse.h index 33084efd4..7ba876b83 100644 --- a/parse.h +++ b/parse.h @@ -5,6 +5,6 @@ BODY *mutt_parse_multipart (FILE *, const char *, long, int); BODY *mutt_parse_messageRFC822 (FILE *, BODY *); BODY *mutt_read_mime_header (FILE *, int); -ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short); +ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short, short); time_t is_from (const char *, char *, size_t); diff --git a/postpone.c b/postpone.c index 3da017194..eb4497e9f 100644 --- a/postpone.c +++ b/postpone.c @@ -254,7 +254,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size return (-1); } - if (mutt_prepare_edit_message (PostContext, hdr, h) < 0) + if (mutt_prepare_template (PostContext, hdr, h, 0) < 0) { mx_fastclose_mailbox (PostContext); #ifdef USE_IMAP @@ -471,93 +471,145 @@ int mutt_parse_pgp_hdr (char *p, int set_signas) #endif /* _PGPPATH */ +/* make sure a body tree is detached from the corresponding header */ -int mutt_prepare_edit_message (CONTEXT *ctx, HEADER *newhdr, HEADER *hdr) +static void forget_header_pointers (BODY *b) { - PARAMETER *par; - MESSAGE *msg = mx_open_message (ctx, hdr->msgno); + for (; b; b = b->next) + { + if (b->type == TYPEMESSAGE && b->hdr) + b->hdr = NULL; + + forget_header_pointers (b->parts); + } +} + +int mutt_prepare_template (CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, + short weed) +{ + PARAMETER *par, **ppar; + MESSAGE *msg; char file[_POSIX_PATH_MAX]; + BODY *b; + LIST *p, **q; - if (msg == NULL) + if ((msg = mx_open_message (ctx, hdr->msgno)) == NULL) return (-1); + /* parse the message header */ fseek (msg->fp, hdr->offset, 0); - newhdr->env = mutt_read_rfc822_header (msg->fp, newhdr, 1); + newhdr->env = mutt_read_rfc822_header (msg->fp, newhdr, 1, weed); - if (hdr->content->type == TYPEMESSAGE || hdr->content->type == TYPEMULTIPART) + /* weed user-agent, x-mailer - we don't want them here */ + p = newhdr->env->userhdrs; + q = &newhdr->env->userhdrs; + + while (p) { - BODY *b; + if (!strncasecmp (p->data, "x-mailer:", 9) || !strncasecmp (p->data, "user-agent:", 11)) + { + *q = p->next; + p->next = NULL; + mutt_free_list (&p); + } + else + q = &p->next; + + p = *q; + } - mutt_parse_part (msg->fp, hdr->content); + safe_free ((void **) &newhdr->env->message_id); - /* Now that we know what was in the other message, convert to the new - * message. - */ - newhdr->content = hdr->content->parts; - for (b = hdr->content->parts; b; b = b->next) - { - file[0] = '\0'; - if (b->filename) - strfcpy (file, b->filename, sizeof (file)); - else - /* avoid Content-Disposition: header with temporary filename */ - b->use_disp = 0; - mutt_adv_mktemp (file, sizeof(file)); - if (mutt_save_attachment (msg->fp, b, file, 0, NULL) == -1) - { - mutt_free_envelope (&newhdr->env); - mutt_free_body (&newhdr->content); - mx_close_message (&msg); - return (-1); - } - safe_free ((void *) &b->filename); - b->filename = safe_strdup (file); - b->unlink = 1; + /* make sure we parse the message */ + mutt_parse_part (msg->fp, hdr->content); - if (mutt_is_text_type (b->type, b->subtype)) - b->noconv = 1; - - mutt_stamp_attachment (b); - mutt_free_body (&b->parts); - } - hdr->content->parts = NULL; - if (hdr->content->type == TYPEMESSAGE && hdr->content->hdr) - hdr->content->hdr->content = NULL; + /* copy the MIME structure */ + b = mutt_new_body (); + memcpy (b, hdr->content, sizeof (BODY)); + hdr->content->parts = NULL; + + /* detach the temporary MIME structure from the message. */ + b->xtype = safe_strdup (b->xtype); + b->subtype = safe_strdup (b->subtype); + b->form_name = safe_strdup (b->form_name); + b->filename = safe_strdup (b->filename); + b->d_filename = safe_strdup (b->d_filename); + + forget_header_pointers (b); + + /* copy parameters */ + for (par = b->parameter, ppar = &b->parameter; par; ppar = &(*ppar)->next, par = par->next) + { + *ppar = mutt_new_parameter (); + (*ppar)->attribute = safe_strdup (par->attribute); + (*ppar)->value = safe_strdup (par->value); } - else + +#ifdef _PGPPATH + + /* + * remove a potential multipart/signed layer - useful when + * resending messages + */ + + if (mutt_is_multipart_signed (b)) { - BODY *b = hdr->content; - file[0] = 0; + newhdr->pgp |= PGPSIGN; + + /* destroy the signature */ + mutt_free_body (&b->parts->next); + b = mutt_remove_multipart (b); + } +#endif + + /* + * We don't need no primary multipart. + * Note: We _do_ preserve messages! + * + * XXX - we don't handle multipart/alternative in any + * smart way when sending messages. + * + */ + + if (b->type == TYPEMULTIPART) + b = mutt_remove_multipart (b); + + newhdr->content = b; + + /* create temporary files for all attachments */ + for (; b; b = b->next) + { + file[0] = '\0'; if (b->filename) strfcpy (file, b->filename, sizeof (file)); + else + /* avoid Content-Disposition: header with temporary filename */ + b->use_disp = 0; + mutt_adv_mktemp (file, sizeof(file)); - if (mutt_save_attachment (msg->fp, hdr->content, file, 0, NULL) == -1) + if (mutt_save_attachment (msg->fp, b, file, 0, NULL) == -1) { mutt_free_envelope (&newhdr->env); + /* XXX hack around problem with mutt_free_body */ + newhdr->content = mutt_make_multipart (newhdr->content); + mutt_free_body (&newhdr->content); mx_close_message (&msg); - return (-1); + return -1; } - newhdr->content = mutt_make_file_attach (file); - FREE (&newhdr->content->subtype); - FREE (&newhdr->content->xtype); - FREE (&newhdr->content->description); - - newhdr->content->type = hdr->content->type; - newhdr->content->xtype = safe_strdup (hdr->content->xtype); - newhdr->content->subtype = safe_strdup (hdr->content->subtype); - newhdr->content->description = safe_strdup (hdr->content->description); - - for (par = hdr->content->parameter; par; par = par->next) - mutt_set_parameter (par->attribute, par->value, &newhdr->content->parameter); + safe_free ((void *) &b->filename); + b->filename = safe_strdup (file); + b->unlink = 1; - if (mutt_is_text_type (newhdr->content->type, newhdr->content->subtype)) - newhdr->content->noconv = 1; - - newhdr->content->use_disp = 0; /* no content-disposition */ - newhdr->content->unlink = 1; /* delete when we are done */ + if (mutt_is_text_type (b->type, b->subtype)) + b->noconv = 1; + + mutt_stamp_attachment (b); + mutt_free_body (&b->parts); } + /* that's it. */ mx_close_message (&msg); + return 0; } diff --git a/protos.h b/protos.h index 96faff164..e7079d2bf 100644 --- a/protos.h +++ b/protos.h @@ -87,7 +87,7 @@ BODY *mutt_parse_multipart (FILE *, const char *, long, int); BODY *mutt_parse_messageRFC822 (FILE *, BODY *); BODY *mutt_read_mime_header (FILE *, int); -ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short); +ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short, short); HEADER *mutt_dup_header (HEADER *); ATTACHPTR **mutt_gen_attach_list (BODY *, int, ATTACHPTR **, short *, short *, int, int); @@ -217,7 +217,7 @@ int mutt_display_message (HEADER *h); int mutt_edit_attachment(BODY *); int mutt_edit_message (CONTEXT *, HEADER *); int mutt_parent_message (CONTEXT *, HEADER *); -int mutt_prepare_edit_message(CONTEXT *, HEADER *, HEADER *); +int mutt_prepare_template(CONTEXT *, HEADER *, HEADER *, short); #define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL) int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char ***, int *); #define mutt_enter_string(A,B,C,D,E) _mutt_enter_string(A,B,C,D,E,0,NULL,NULL) diff --git a/recvattach.c b/recvattach.c index 20849075f..ed60b7777 100644 --- a/recvattach.c +++ b/recvattach.c @@ -851,7 +851,7 @@ static void reply_attachment_list (int op, int tag, HEADER *hdr, BODY *body) char buffer [LONG_STRING]; mutt_message ("Preparing to forward..."); - if (mutt_prepare_edit_message (ctx, newhdr, hn) < 0) + if (mutt_prepare_template (ctx, newhdr, hn, 0) < 0) { mutt_clear_error(); mutt_free_header (&newhdr); diff --git a/send.c b/send.c index 83824767f..b013e7929 100644 --- a/send.c +++ b/send.c @@ -934,13 +934,18 @@ ci_send_message (int flags, /* send mode */ { msg = mutt_new_header (); - if (flags == SENDPOSTPONED) + if (flags == SENDRESEND) + { + if (mutt_prepare_template (ctx, msg, cur, 1) < 0) + goto cleanup; + } + else if (flags == SENDPOSTPONED) { if ((flags = mutt_get_postponed (ctx, msg, &cur, fcc, sizeof (fcc))) < 0) goto cleanup; } - if (flags & SENDPOSTPONED) + if (flags & (SENDPOSTPONED|SENDRESEND)) { if ((tempfp = safe_fopen (msg->content->filename, "a+")) == NULL) { @@ -953,7 +958,7 @@ ci_send_message (int flags, /* send mode */ msg->env = mutt_new_envelope (); } - if (! (flags & (SENDKEY | SENDPOSTPONED))) + if (! (flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) { pbody = mutt_new_body (); pbody->next = msg->content; /* don't kill command-line attachments */ @@ -985,7 +990,7 @@ ci_send_message (int flags, /* send mode */ } /* this is handled here so that the user can match ~f in send-hook */ - if (cur && option (OPTREVNAME) && !(flags & (SENDPOSTPONED))) + if (cur && option (OPTREVNAME) && !(flags & (SENDPOSTPONED|SENDRESEND))) { /* we shouldn't have to worry about freeing `msg->env->from' before * setting it here since this code will only execute when doing some @@ -994,7 +999,7 @@ ci_send_message (int flags, /* send mode */ msg->env->from = set_reverse_name (cur->env); } - if (!msg->env->from && option (OPTUSEFROM) && !(flags & (SENDPOSTPONED))) + if (!msg->env->from && option (OPTUSEFROM) && !(flags & (SENDPOSTPONED|SENDRESEND))) msg->env->from = mutt_default_from (); if (flags & SENDBATCH) @@ -1006,7 +1011,7 @@ ci_send_message (int flags, /* send mode */ process_user_header (msg->env); } } - else if (! (flags & (SENDPOSTPONED))) + else if (! (flags & (SENDPOSTPONED|SENDRESEND))) { if ((flags & (SENDREPLY | SENDFORWARD)) && envelope_defaults (msg->env, ctx, cur, flags) == -1) @@ -1076,7 +1081,7 @@ ci_send_message (int flags, /* send mode */ } /* wait until now to set the real name portion of our return address so that $realname can be set in a send-hook */ - if (msg->env->from && !msg->env->from->personal && !(flags & ( SENDPOSTPONED))) + if (msg->env->from && !msg->env->from->personal && !(flags & (SENDRESEND|SENDPOSTPONED))) msg->env->from->personal = safe_strdup (Realname); @@ -1131,7 +1136,7 @@ ci_send_message (int flags, /* send mode */ mutt_edit_file (Editor, msg->content->filename); } - if (! (flags & (SENDPOSTPONED | SENDFORWARD | SENDKEY))) + if (! (flags & (SENDPOSTPONED | SENDFORWARD | SENDKEY | SENDRESEND))) { if (stat (msg->content->filename, &st) == 0) { @@ -1151,7 +1156,7 @@ ci_send_message (int flags, /* send mode */ /* specify a default fcc. if we are in batchmode, only save a copy of * the message if the value of $copy is yes or ask-yes */ - if (!fcc[0] && !(flags & SENDPOSTPONED) && (!(flags & SENDBATCH) || (quadoption (OPT_COPY) & 0x1))) + if (!fcc[0] && !(flags & (SENDRESEND|SENDPOSTPONED)) && (!(flags & SENDBATCH) || (quadoption (OPT_COPY) & 0x1))) { /* set the default FCC */ if (!msg->env->from) diff --git a/sendlib.c b/sendlib.c index 041d6389d..8e00634d3 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1042,7 +1042,7 @@ BODY *mutt_make_message_attach (CONTEXT *ctx, HEADER *hdr, int attach_msg) body->hdr = mutt_new_header(); body->hdr->offset = 0; /* we don't need the user headers here */ - body->hdr->env = mutt_read_rfc822_header(fp, body->hdr, 0); + body->hdr->env = mutt_read_rfc822_header(fp, body->hdr, 0, 0); #ifdef _PGPPATH body->hdr->pgp = pgp; #endif /* _PGPPATH */ @@ -1272,7 +1272,6 @@ 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); @@ -1351,20 +1350,17 @@ 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