From 79a2ab0985b5964aef6025edb7a625af4eebfd29 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 2 Jun 1997 04:58:10 +0000 Subject: Sometimes now we only count header bytes. svn path=/trunk/; revision=1056 --- NEWS | 1 + driver.c | 32 +++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9a677358..94fa8944 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,7 @@ pl 3.9.7 (): * Treat exim's 501 antispam response as equivalent to 571. Note: this is temporary. The right thing is to get exim to return 571; I'm working on it. +* Fess up to sometimes only counting header bytes in the progress messages. There are 257 people on the fetchmail-friends list. diff --git a/driver.c b/driver.c index 14700a52..486c9c47 100644 --- a/driver.c +++ b/driver.c @@ -1426,7 +1426,13 @@ const struct method *proto; /* protocol method table */ count, count > 1 ? "s" : "", buf); } - /* we may need to get sizes in order to check message limits */ + /* + * We may need to get sizes in order to check message + * limits. If we ever decide that always having accurate + * whole-message (as opposed to header) lengths in the + * progress messages is important, all we have to do is + * remove the `&& ctl->limit' here. + */ msgsizes = (int *)NULL; if (!ctl->fetchall && proto->getsizes && ctl->limit) { @@ -1502,9 +1508,29 @@ const struct method *proto; /* protocol method table */ if (outlevel > O_SILENT) { + int havesizes, mlen; + error_build("reading message %d", num); - if (len > 0) - error_build(" (%d bytes)", len); + + if (!protocol->fetch_body) + { + havesizes = TRUE; + mlen = len; + } + else if (msgsizes) + { + havesizes = TRUE; + mlen = msgsizes[num - 1]; + } + else /* no way to know body size yet */ + { + havesizes = FALSE; + mlen = len; + } + + if (mlen > 0) + error_build(" (%d %sbytes)", + mlen, havesizes ? "" : "header "); if (outlevel == O_VERBOSE) error_complete(0, 0, ""); else -- cgit v1.2.3