]> granicus.if.org Git - mutt/commitdiff
#265:
authorMichael Elkins <me@sigpipe.org>
Mon, 9 Sep 2002 20:15:54 +0000 (20:15 +0000)
committerMichael Elkins <me@sigpipe.org>
Mon, 9 Sep 2002 20:15:54 +0000 (20:15 +0000)
> Suppose a user wants to fcc to a file (e.g., /a/b/c) but accidentally
> typed a = before the path name. Mutt will fail to find the =/a/b/c
> folder, display the error message and beep, but immediately erase the
> error message; the mail will be sent even though the fcc failed. (The
> same can be accomplished by accidentally mistyping other parts of the
> path name.) On local systems where screen update is quick, the user
> might not notice the error message at all.
>
> The problem with this behaviour is that the user might have no chance
> to read the error message if the screen update is quick enough; as a
> result (s)he might not notice that the fcc failed.
>
> A related thing (probably can't be classified as a problem) is that if
> fcc fails, the user probably don't want to send the mail out because
> if fcc is requested (s)he probably very much want to keep a copy of
> the sent mail.

Try the following patch.  We keep track of whether or not the fcc
failed with a local var `fcc_error' and perform the same behavior as
if the actual send of the message failed (without really sending)
when the FCC fails, thus giving the user a chance to correct the
error.

send.c

diff --git a/send.c b/send.c
index 8c315d2af63c82ccd172b3161e92eee74cc175ce..4489629c57a9cc1482fc6db903cb622c80590b22 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1038,6 +1038,7 @@ ci_send_message (int flags,               /* send mode */
   FILE *tempfp = NULL;
   BODY *pbody;
   int i, killfrom = 0;
+  int fcc_error = 0;
 
 #if defined(HAVE_PGP) || defined(HAVE_SMIME)
   BODY *save_content = NULL;
@@ -1353,6 +1354,7 @@ ci_send_message (int flags,               /* send mode */
   {
 main_loop:
 
+    fcc_error = 0; /* reset value since we may have failed before */
     mutt_pretty_mailbox (fcc);
     i = mutt_compose_menu (msg, fcc, sizeof (fcc), cur);
     if (i == -1)
@@ -1538,7 +1540,13 @@ full_fcc:
        * message was first postponed.
        */
       msg->received = time (NULL);
-      mutt_write_fcc (fcc, msg, NULL, 0, NULL);
+      if (mutt_write_fcc (fcc, msg, NULL, 0, NULL) == -1)
+      {
+       /*
+        * Error writing FCC, we should abort sending.
+        */
+       fcc_error = 1;
+      }
     }
 
     msg->content = tmpbody;
@@ -1568,7 +1576,12 @@ full_fcc:
   }
 
 
-  if ((i = send_message (msg)) == -1)
+  /*
+   * Don't attempt to send the message if the FCC failed.  Just pretend
+   * the send failed as well so we give the user a chance to fix the
+   * error.
+   */
+  if (fcc_error || (i = send_message (msg)) == -1)
   {
     if (!(flags & SENDBATCH))
     {