]> granicus.if.org Git - mutt/commitdiff
Silence imap progress messages for pipe-message. (see #3929)
authorKevin McCarthy <kevin@8t8.us>
Sat, 8 Apr 2017 21:18:26 +0000 (14:18 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 8 Apr 2017 21:18:26 +0000 (14:18 -0700)
_mutt_pipe_message() calls endwin(), and then calls pipe_msg().  If an
imap message body hasn't already been downloaded, this can end up
calling imap_fetch_message().

The progress messages in imap_fetch_message() were restoring curses,
just after extract_url was running.  This was leading to a condition
where mutt curses didn't think the screen had changed after
extract_url exited.

There was already a check for isendwin() inside imap_fetch_message(),
but it wasn't wrapped around the progressbar creation/usage.  Add a
check for those places too.

imap/message.c

index bd03bd49c25b5ec4a182dab8f101b934a1a65d7e..db6667319581054c058aa903082afb15153b64f8 100644 (file)
@@ -428,6 +428,7 @@ int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno)
   /* Sam's weird courier server returns an OK response even when FETCH
    * fails. Thanks Sam. */
   short fetched = 0;
+  int output_progress;
 
   idata = (IMAP_DATA*) ctx->data;
   h = ctx->hdrs[msgno];
@@ -458,7 +459,10 @@ int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno)
     }
   }
 
-  if (!isendwin())
+  /* This function is called in a few places after endwin()
+   * e.g. _mutt_pipe_message(). */
+  output_progress = !isendwin ();
+  if (output_progress)
     mutt_message _("Fetching message...");
 
   if (!(msg->fp = msg_cache_put (idata, h)))
@@ -516,9 +520,13 @@ int imap_fetch_message (CONTEXT *ctx, MESSAGE *msg, int msgno)
            imap_error ("imap_fetch_message()", buf);
            goto bail;
          }
-         mutt_progress_init (&progressbar, _("Fetching message..."),
-                             MUTT_PROGRESS_SIZE, NetInc, bytes);
-         if (imap_read_literal (msg->fp, idata, bytes, &progressbar) < 0)
+          if (output_progress)
+          {
+            mutt_progress_init (&progressbar, _("Fetching message..."),
+                                MUTT_PROGRESS_SIZE, NetInc, bytes);
+          }
+         if (imap_read_literal (msg->fp, idata, bytes,
+                                 output_progress ? &progressbar : NULL) < 0)
            goto bail;
          /* pick up trailing line */
          if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE)