]> granicus.if.org Git - mutt/commitdiff
Preserve FCC headers when postponing. From Vikas.
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 27 Oct 1998 09:41:13 +0000 (09:41 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 27 Oct 1998 09:41:13 +0000 (09:41 +0000)
compose.c
postpone.c
protos.h
send.c
sendlib.c

index 4b34b8dc67df2aade1250b07c74c828776ee31fd..035a8cabdbe1e7840d3246a0488b76073ef4f478 100644 (file)
--- 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.");
index c33cede5ebb836235e9baf052b1eb4857904ef22..dfa55fd84e518978980eb7abb5f8f9b65feb08ce 100644 (file)
@@ -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;
+    }
 
 
 
index d978fb9d4ce7d50558b36790d13f7f202dbd9b57..72f8c966b94a6ca184c7634b9528c8d38c04ee74 100644 (file)
--- 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 c90b0aa93406e2990d35d1ba95a5d57f5b70ac2e..7f9d06c9efa678970839f8a038d73b09c2b2a4df 100644 (file)
--- 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
index e4401bcc241218b91d1852128f1aa89e02cc3200..3fd6776264ebf9389381f3a9239e4a99da64fa89 100644 (file)
--- 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");