]> granicus.if.org Git - neomutt/commitdiff
Introduce the OPTUSEHEADERDATE pseudo-option to control
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Sep 1998 05:57:22 +0000 (05:57 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Sep 1998 05:57:22 +0000 (05:57 +0000)
mutt_write_rfc822_header()'s behaviour for the purposes of
the edit_message feature.

compose.c
curs_main.c
mutt.h
sendlib.c

index dee6689b1c5c17bf8a60e07fbb33feec0ccdb69d..43f1bfaaadd3cc434646760080b236969204a941 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -1063,16 +1063,20 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
        if (mutt_enter_fname ("Write message to mailbox", fname, sizeof (fname),
                              &menu->redraw, 1) != -1 && fname[0])
        {
+        int oldhdrdate;
          mutt_message ("Writing message to %s ...", fname);
          mutt_expand_path (fname, sizeof (fname));
 
          if (msg->content->next)
            msg->content = mutt_make_multipart (msg->content);
 
-         if (mutt_write_fcc (NONULL (fname), msg, NULL, 2) < 0)
+        oldhdrdate = option(OPTUSEHEADERDATE);
+        set_option(OPTUSEHEADERDATE);
+         if (mutt_write_fcc (NONULL (fname), msg, NULL, 1) < 0)
            msg->content = mutt_remove_multipart (msg->content);
          else
            mutt_message ("Message written.");
+        if(!oldhdrdate) unset_option(OPTUSEHEADERDATE);
        }
        break;
 
index ec8652bd279e3eacedeb662c7239b71322e28153..1179f4b874b8596d8f776b7c7ed03ba2e43711c3 100644 (file)
@@ -1485,8 +1485,10 @@ int mutt_index_menu (int attach_msg /* invoked while attaching a message */)
 
        CHECK_MSGCOUNT;
        CHECK_READONLY;
-
+        
+        set_option(OPTUSEHEADERDATE);
        ci_send_message (SENDEDITMSG, NULL, NULL, Context, CURHDR);
+        unset_option(OPTUSEHEADERDATE);
        menu->redraw = REDRAW_FULL;
        break;
 
diff --git a/mutt.h b/mutt.h
index 6e5d18cb78b4762e8a1be4f1ada2d144a10e2795..bc89caf83acecfd0ae8d9219847c7546bd1c4eee 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -331,7 +331,8 @@ enum
   OPTSORTSUBTHREADS,   /* (pseudo) used when $sort_aux changes */
   OPTNEEDRESCORE,      /* (pseudo) set when the `score' command is used */
   OPTSORTCOLLAPSE,     /* (pseudo) used by mutt_sort_headers() */
-
+  OPTUSEHEADERDATE,    /* (pseudo) used by edit-message */
+  
 #ifdef _PGPPATH
   OPTPGPCHECKTRUST,    /* (pseudo) used by pgp_select_key () */
   OPTDONTHANDLEPGPKEYS,        /* (pseudo) used to extract PGP keys */
@@ -340,7 +341,6 @@ enum
 
 
 
-
   OPTMAX
 };
 
index 63c2239c23db57f7760b06b35a66fc3fe52b0914..d0d15c3d3e50904769a2b3026206b4d7a8bbec9f 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1205,7 +1205,6 @@ static void write_references (LIST *r, FILE *f)
  * mode == 1  => "lite" mode (used for edit_hdrs)
  * mode == 0  => normal mode.  write full header + MIME headers
  * mode == -1 => write just the envelope info (used for postponing messages)
- * mode == -2 => just like -1, but write the Date: from the message (used for edit-message support)
  */
 
 int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach, int mode)
@@ -1213,15 +1212,16 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach, int mode)
   char buffer[LONG_STRING];
   LIST *tmp = env->userhdrs;
 
-  if (mode == 0)
-    fputs (mutt_make_date (buffer, sizeof(buffer)), fp);
-  else if (mode == -2)
+  if (option(OPTUSEHEADERDATE))
   {
     if(env->date)
       fprintf(fp, "Date: %s\n", env->date);
     else
       fputs (mutt_make_date(buffer, sizeof(buffer)), fp);
   }
+  else if (mode == 0)
+    fputs (mutt_make_date (buffer, sizeof(buffer)), fp);
+
 
 
   /* OPTUSEFROM is not consulted here so that we can still write a From:
@@ -1876,8 +1876,6 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post)
   }
 
   /* post == 1 => postpone message. Set mode = -1 in mutt_write_rfc822_header()
-   * post == 2 => Editing this message.
-   *              Set mode = -2 in mutt_write_rfc822_header()
    * post == 0 => Normal mode. Set mode = 0 in mutt_write_rfc822_header() 
    * */
   mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, post ? -post : 0);