From: Thomas Roessler Date: Tue, 27 Oct 1998 09:41:13 +0000 (+0000) Subject: Preserve FCC headers when postponing. From Vikas. X-Git-Tag: mutt-0-94-15-rel~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06208d7a67fca765d82919a586ceb5ad2a671f73;p=mutt Preserve FCC headers when postponing. From Vikas. --- diff --git a/compose.c b/compose.c index 4b34b8dc..035a8cab 100644 --- a/compose.c +++ b/compose.c @@ -1090,7 +1090,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ oldhdrdate = option(OPTUSEHEADERDATE); set_option(OPTUSEHEADERDATE); - if (mutt_write_fcc (NONULL (fname), msg, NULL, 1) < 0) + if (mutt_write_fcc (NONULL (fname), msg, NULL, 1, NULL) < 0) msg->content = mutt_remove_multipart (msg->content); else mutt_message _("Message written."); diff --git a/postpone.c b/postpone.c index c33cede5..dfa55fd8 100644 --- a/postpone.c +++ b/postpone.c @@ -158,13 +158,15 @@ static HEADER *select_msg (void) * hdr envelope/attachment info for recalled message * cur if message was a reply, `cur' is set to the message which * `hdr' is in reply to + * fcc fcc for the recalled message + * fcclen max length of fcc * * return vals: * -1 error/no messages * 0 normal exit * SENDREPLY recalled message is a reply */ -int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur) +int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size_t fcclen) { HEADER *h; int code = SENDPOSTPONED; @@ -251,6 +253,23 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur) if (*cur) code |= SENDREPLY; } + else if (strncasecmp ("X-Mutt-Fcc:", tmp->data, 11) == 0) + { + p = tmp->data + 11; + SKIPWS (p); + strfcpy (fcc, p, fcclen); + mutt_pretty_mailbox (fcc); + + /* remove the X-Mutt-Fcc: header field */ + next = tmp->next; + if (last) + last->next = tmp->next; + else + hdr->env->userhdrs = tmp->next; + tmp->next = NULL; + mutt_free_list (&tmp); + tmp = next; + } diff --git a/protos.h b/protos.h index d978fb9d..72f8c966 100644 --- a/protos.h +++ b/protos.h @@ -226,7 +226,7 @@ int mutt_enter_fname (const char *, char *, size_t, int *, int); int mutt_enter_string (unsigned char *, size_t, int, int, int); int mutt_get_field (char *, char *, size_t, int); int mutt_get_password (char *, char *, size_t); -int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **); +int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t); int mutt_get_tmp_attachment (BODY *); int mutt_index_menu (void); int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, const char *, int); @@ -267,7 +267,7 @@ int mutt_user_is_recipient (HEADER *); int mutt_view_attachment (FILE*, BODY *, int); int mutt_wait_filter (pid_t); int mutt_which_case (const char *); -int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int); +int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int, char *); int mutt_write_mime_body (BODY *, FILE *); int mutt_write_mime_header (BODY *, FILE *); int mutt_write_rfc822_header (FILE *, ENVELOPE *, BODY *, int); diff --git a/send.c b/send.c index c90b0aa9..7f9d06c9 100644 --- a/send.c +++ b/send.c @@ -888,7 +888,7 @@ ci_send_message (int flags, /* send mode */ } else if (flags == SENDPOSTPONED) { - if ((flags = mutt_get_postponed (ctx, msg, &cur)) < 0) + if ((flags = mutt_get_postponed (ctx, msg, &cur, fcc, sizeof (fcc))) < 0) goto cleanup; } @@ -1136,7 +1136,7 @@ main_loop: /* postpone the message until later. */ if (msg->content->next) msg->content = mutt_make_multipart (msg->content); - if (!Postponed || mutt_write_fcc (NONULL (Postponed), msg, (cur && (flags & SENDREPLY)) ? cur->env->message_id : NULL, 1) < 0) + if (!Postponed || mutt_write_fcc (NONULL (Postponed), msg, (cur && (flags & SENDREPLY)) ? cur->env->message_id : NULL, 1, fcc) < 0) { msg->content = mutt_remove_multipart (msg->content); goto main_loop; @@ -1276,7 +1276,7 @@ main_loop: full_fcc: #endif /* _PGPPATH */ if (msg->content) - mutt_write_fcc (fcc, msg, NULL, 0); + mutt_write_fcc (fcc, msg, NULL, 0, NULL); msg->content = tmpbody; #ifdef _PGPPATH diff --git a/sendlib.c b/sendlib.c index e4401bcc..3fd67762 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1893,7 +1893,7 @@ ADDRESS *mutt_remove_duplicates (ADDRESS *addr) return (top); } -int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post) +int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, char *fcc) { CONTEXT f; MESSAGE *msg; @@ -1942,6 +1942,12 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post) */ if (post && msgid) fprintf (msg->fp, "X-Mutt-References: %s\n", msgid); + + /* (postponment) save the Fcc: using a special X-Mutt- header so that + * it can be picked up when the message is recalled + */ + if (post && fcc) + fprintf (msg->fp, "X-Mutt-Fcc: %s\n", fcc); fprintf (msg->fp, "Status: RO\n");