This is necessary to let the mbox driver print useful percentages. If there's no
percentage given and we have a size, calculate on it on our own. Closes #2929.
+2007-11-06 17:22 +0100 Rocco Rutte <pdmef@gmx.net> (eae335942190)
+
+ * mh.c: (Re-)Add total msg count to progress for parsing maildirs
+
+2007-11-05 14:24 -0800 Vincent Lefevre <vincent@vinc17.org> (ecb694b6176b)
+
+ * po/fr.po: Updated French translation
+
+2007-11-05 17:47 +0100 Rocco Rutte <pdmef@gmx.net> (6b9e91edba54)
+
+ * ChangeLog, curs_lib.c: Save value of errno across mutt_endwin()
+ calls. Mutt_endwin() is sometimes called after noticing an error but
+ before printing the message via perror(). Closes #2965.
+
2007-11-05 15:53 +0100 Emanuele Giaquinta <e.giaquinta@glauco.it> (b8dc6926ddf4)
* doc/manual.xml.head: Manual: Fix typo
progress->flags = flags;
progress->msg = msg;
progress->size = size;
- mutt_progress_update (progress, 0);
+ mutt_progress_update (progress, 0, 0);
}
-void mutt_progress_update (progress_t* progress, long pos)
+void mutt_progress_update (progress_t* progress, long pos, int percent)
{
char posstr[SHORT_STRING];
short update = 0;
if (update)
{
progress->pos = pos;
- if (progress->size)
- mutt_message ("%s %s/%s", progress->msg, posstr, progress->sizestr);
+ if (progress->size > 0)
+ {
+ mutt_message ("%s %s/%s (%d%%)", progress->msg, posstr, progress->sizestr,
+ percent > 0 ? percent : progress->pos * 100 / progress->size);
+ }
else
- mutt_message ("%s %s", progress->msg, posstr);
+ {
+ if (percent > 0)
+ mutt_message ("%s %s (%d%%)", progress->msg, posstr, percent);
+ else
+ mutt_message ("%s %s", progress->msg, posstr);
+ }
}
if (pos >= progress->size)
fputc (c, fp);
if (pbar && !(pos % 1024))
- mutt_progress_update (pbar, pos);
+ mutt_progress_update (pbar, pos, -1);
#ifdef DEBUG
if (debuglevel >= IMAP_LOG_LTRL)
fputc (c, debugfile);
for (msgno = msgbegin; msgno <= msgend ; msgno++)
{
- mutt_progress_update (&progress, msgno + 1);
+ mutt_progress_update (&progress, msgno + 1, -1);
memset (&h, 0, sizeof (h));
h.data = safe_calloc (1, sizeof (IMAP_HEADER_DATA));
for (msgno = msgbegin; msgno <= msgend ; msgno++)
{
- mutt_progress_update (&progress, msgno + 1);
+ mutt_progress_update (&progress, msgno + 1, -1);
/* we may get notification of new mail while fetching headers */
if (msgno + 1 > fetchlast)
{
sent += len;
flush_buffer(buf, &len, idata->conn);
- mutt_progress_update (&progressbar, sent);
+ mutt_progress_update (&progressbar, sent, -1);
}
}
count++;
if (!ctx->quiet)
- mutt_progress_update (&progress, count);
+ mutt_progress_update (&progress, count,
+ (int)loc / (ctx->size / 100 + 1));
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory (ctx);
count++;
if (!ctx->quiet)
- mutt_progress_update (&progress, count);
+ mutt_progress_update (&progress, count,
+ (int)(ftell (ctx->fp) / (ctx->size / 100 + 1)));
if (ctx->msgcount == ctx->hdrmax)
mx_alloc_memory (ctx);
for (i = first, j = 0; i < ctx->msgcount; i++)
{
if (!ctx->quiet)
- mutt_progress_update (&progress, i);
+ mutt_progress_update (&progress, i, (int)(ftell (ctx->fp) / (ctx->size / 100 + 1)));
/*
* back up some information which is needed to restore offsets when
* something fails.
{
(*count)++;
if (!ctx->quiet && progress)
- mutt_progress_update (progress, *count);
+ mutt_progress_update (progress, *count, -1);
}
if (subdir)
continue;
if (!ctx->quiet && progress)
- mutt_progress_update (progress, count);
+ mutt_progress_update (progress, count, -1);
#if USE_HCACHE
data = mutt_hcache_fetch (hc, p->h->path + 3, &maildir_hcache_keylen);
for (i = 0; i < ctx->msgcount; i++)
{
if (!ctx->quiet)
- mutt_progress_update (&progress, i);
+ mutt_progress_update (&progress, i, -1);
if (ctx->hdrs[i]->deleted
&& (ctx->magic != M_MAILDIR || !option (OPTMAILDIRTRASH)))
void mutt_progress_init (progress_t* progress, const char *msg,
unsigned short flags, unsigned short inc,
long size);
-void mutt_progress_update (progress_t* progress, long pos);
+/* If percent is positive, it is displayed as percentage, otherwise
+ * percentage is calculated from progress->size and pos if progress
+ * was initialized with positive size, otherwise no percentage is shown */
+void mutt_progress_update (progress_t* progress, long pos, int percent);
static inline int mutt_term_width(short wrap)
{
for (i = 0; i < Context->msgcount; i++)
{
- mutt_progress_update (&progress, i);
+ mutt_progress_update (&progress, i, -1);
/* new limit pattern implicitly uncollapses all threads */
Context->hdrs[i]->virtual = -1;
Context->hdrs[i]->limited = 0;
{
for (i = 0; i < Context->vcount; i++)
{
- mutt_progress_update (&progress, i);
+ mutt_progress_update (&progress, i, -1);
if (mutt_pattern_exec (pat, M_MATCH_FULL_ADDRESS, Context, Context->hdrs[Context->v2r[i]]))
{
switch (op)
for (i = cur + incr, j = 0 ; j != Context->vcount; j++)
{
- mutt_progress_update (&progress, j);
+ mutt_progress_update (&progress, j, -1);
if (i > Context->vcount - 1)
{
i = 0;
for (i = old_count; i < new_count; i++)
{
if (!ctx->quiet)
- mutt_progress_update (&progress, i + 1 - old_count);
+ mutt_progress_update (&progress, i + 1 - old_count, -1);
#if USE_HCACHE
if ((data = mutt_hcache_fetch (hc, ctx->hdrs[i]->data, strlen)))
{
{
j++;
if (!ctx->quiet)
- mutt_progress_update (&progress, j);
+ mutt_progress_update (&progress, j, -1);
snprintf (buf, sizeof (buf), "DELE %d\r\n", ctx->hdrs[i]->refno);
if ((ret = pop_query (pop_data, buf, sizeof (buf))) == 0)
{
else
{
if (progressbar)
- mutt_progress_update (progressbar, pos);
+ mutt_progress_update (progressbar, pos, -1);
if (ret == 0 && funct (inbuf, data) < 0)
ret = -3;
lenbuf = 0;
return smtp_err_write;
}
- mutt_progress_update (&progress, ftell (fp));
+ mutt_progress_update (&progress, ftell (fp), -1);
}
fclose (fp);