PATCH: mutt_progress_init() should not be called when ctx->quiet is non-zero
Good afternoon,
I've been working on a patch which affects the way mail boxes are
processed. My original work was based Mutt v1.5.17 RELEASE, but I
decided I really ought to be using the nightly snapshots. When I
switched to the latter I noticed an very annoying regression: whenever
my changes opened a mail box I got progress information at the bottom of
the screen (although the various counts were always zero). This was
definitely not what I wanted! After working out what had changed I came
up with the following patch which fixes my problem.
Basically, in the mail box code calls to mutt_progress_update() are only
made if ctx->quiet is clear, whereas calls to mutt_progress_init() do
not test ctx->quiet. I believe this to be a bug. My patch adds
suitable tests before the calls to mutt_progress_init().
Cheers,
Nick.
--
--- mbox.c~ 2007-11-07 08:00:07.000000000 +0000
+++ mbox.c 2008-03-08 16:09:04.000000000 +0000
@@ -118,8 +118,11 @@
buf[sizeof (buf) - 1] = 0;
- snprintf (msgbuf, sizeof (msgbuf), _("Reading %s..."), ctx->path);
- mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, 0);
+ if (!ctx->quiet)
+ {
+ snprintf (msgbuf, sizeof (msgbuf), _("Reading %s..."), ctx->path);
+ mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, 0);
+ }
FOREVER
{
@@ -269,8 +272,11 @@
date received */
tz = mutt_local_tz (0);
- snprintf (msgbuf, sizeof (msgbuf), _("Reading %s..."), ctx->path);
- mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, 0);
+ if (!ctx->quiet)
+ {
+ snprintf (msgbuf, sizeof (msgbuf), _("Reading %s..."), ctx->path);
+ mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, 0);
+ }
loc = ftello (ctx->fp);
while (fgets (buf, sizeof (buf), ctx->fp) != NULL)
@@ -784,8 +790,11 @@
newOffset = safe_calloc (ctx->msgcount - first, sizeof (struct m_update_t));
oldOffset = safe_calloc (ctx->msgcount - first, sizeof (struct m_update_t));
- snprintf (msgbuf, sizeof (msgbuf), _("Writing %s..."), ctx->path);
- mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, WriteInc,
ctx->msgcount);
+ if (!ctx->quiet)
+ {
+ snprintf (msgbuf, sizeof (msgbuf), _("Writing %s..."), ctx->path);
+ mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, WriteInc,
ctx->msgcount);
+ }
for (i = first, j = 0; i < ctx->msgcount; i++)
{
--- mh.c~ 2008-01-16 08:00:05.000000000 +0000
+++ mh.c 2008-03-08 16:10:51.000000000 +0000
@@ -1111,8 +1111,11 @@
progress_t progress;
memset (&mhs, 0, sizeof (mhs));
- snprintf (msgbuf, sizeof (msgbuf), _("Scanning %s..."), ctx->path);
- mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, 0);
+ if (!ctx->quiet)
+ {
+ snprintf (msgbuf, sizeof (msgbuf), _("Scanning %s..."), ctx->path);
+ mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, 0);
+ }
if (!ctx->data)
{
@@ -1129,8 +1132,11 @@
if (maildir_parse_dir (ctx, &last, subdir, &count, &progress) == -1)
return -1;
- snprintf (msgbuf, sizeof (msgbuf), _("Reading %s..."), ctx->path);
- mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, count);
+ if (!ctx->quiet)
+ {
+ snprintf (msgbuf, sizeof (msgbuf), _("Reading %s..."), ctx->path);
+ mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, ReadInc, count);
+ }
maildir_delayed_parsing (ctx, &md, &progress);
if (ctx->magic == M_MH)
@@ -1625,8 +1631,11 @@
hc = mutt_hcache_open(HeaderCache, ctx->path, NULL);
#endif /* USE_HCACHE */
- snprintf (msgbuf, sizeof (msgbuf), _("Writing %s..."), ctx->path);
- mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, WriteInc,
ctx->msgcount);
+ if (!ctx->quiet)
+ {
+ snprintf (msgbuf, sizeof (msgbuf), _("Writing %s..."), ctx->path);
+ mutt_progress_init (&progress, msgbuf, M_PROGRESS_MSG, WriteInc,
ctx->msgcount);
+ }
for (i = 0; i < ctx->msgcount; i++)
{