aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-09-30 18:56:52 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-09-30 18:56:52 +0000
commit13b4a157ef192674da662553584253ae7c0f3b52 (patch)
tree778943f1356f7982d4af496aadd3607021eedb29
parent9ae98cb27ed3c6856a5169f96ce11f278b057e2d (diff)
downloadfetchmail-13b4a157ef192674da662553584253ae7c0f3b52.tar.gz
fetchmail-13b4a157ef192674da662553584253ae7c0f3b52.tar.bz2
fetchmail-13b4a157ef192674da662553584253ae7c0f3b52.zip
Eliminate the "No mail" message on second and later passes.
svn path=/trunk/; revision=1438
-rw-r--r--driver.c20
-rw-r--r--fetchmail.h1
-rw-r--r--imap.c5
3 files changed, 15 insertions, 11 deletions
diff --git a/driver.c b/driver.c
index 3ea9b062..c799ed77 100644
--- a/driver.c
+++ b/driver.c
@@ -73,6 +73,7 @@ extern char *strstr(); /* needed on sysV68 R3V7.1. */
int fetchlimit; /* how often to tear down the server connection */
int batchcount; /* count of messages sent in current batch */
flag peek_capable; /* can we peek for better error recovery? */
+int pass; /* how many times have we re-polled? */
static const struct method *protocol;
static jmp_buf restart;
@@ -1348,6 +1349,7 @@ const struct method *proto; /* protocol method table */
}
protocol = proto;
+ pass = 0;
tagnum = 0;
tag[0] = '\0'; /* nuke any tag hanging out from previous query */
ok = 0;
@@ -1536,6 +1538,8 @@ const struct method *proto; /* protocol method table */
for (idp = ctl->mailboxes; idp; idp = idp->next)
{
do {
+ ++pass;
+
if (outlevel >= O_VERBOSE)
if (idp->next)
error(0, 0, "selecting or re-polling folder %s");
@@ -1557,14 +1561,7 @@ const struct method *proto; /* protocol method table */
if (outlevel > O_SILENT)
if (count == -1) /* only used for ETRN */
error(0, 0, "Polling %s", realname);
- else if (count == 0)
- {
- /* these are pointless in normal daemon mode */
- if (poll_interval == 0 || outlevel == O_VERBOSE )
- error(0, 0, "No mail at %s", buf);
- break;
- }
- else
+ else if (count != 0)
{
if (new != -1 && (count - new) > 0)
error(0, 0, "%d message%s (%d seen) at %s.",
@@ -1573,6 +1570,13 @@ const struct method *proto; /* protocol method table */
error(0, 0, "%d message%s at %s.",
count, count > 1 ? "s" : "", buf);
}
+ else
+ {
+ /* these are pointless in normal daemon mode */
+ if (pass == 1 && (poll_interval == 0 || outlevel == O_VERBOSE))
+ error(0, 0, "No mail at %s", buf);
+ break;
+ }
if (check_only)
{
diff --git a/fetchmail.h b/fetchmail.h
index 91c6bbf6..17dbeb22 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -209,6 +209,7 @@ extern flag versioninfo; /* emit only version info */
extern char *user; /* name of invoking user */
extern char *home; /* home directory of invoking user */
extern char *fetchmailhost; /* the name of the host running fetchmail */
+extern int pass; /* number of re-polling pass */
/* prototypes for globally callable functions */
diff --git a/imap.c b/imap.c
index 9e4a8c3b..cb3437a8 100644
--- a/imap.c
+++ b/imap.c
@@ -33,7 +33,7 @@ extern char *strstr(); /* needed on sysV68 R3V7.1. */
#define IMAP4 0 /* IMAP4 rev 0, RFC1730 */
#define IMAP4rev1 1 /* IMAP4 rev 1, RFC2060 */
-static int count,seen,recent,unseen, deletions,expunged, imap_version, pass;
+static int count, seen, recent, unseen, deletions,expunged, imap_version;
int imap_ok(int sock, char *argbuf)
/* parse command response */
@@ -419,7 +419,7 @@ static int imap_getrange(int sock,
/* find out how many messages are waiting */
recent = unseen = -1;
- if (++pass > 1)
+ if (pass > 1)
{
ok = gen_transact(sock, "NOOP");
if (ok != 0)
@@ -684,7 +684,6 @@ const static struct method imap =
int doIMAP(struct query *ctl)
/* retrieve messages using IMAP Version 2bis or Version 4 */
{
- pass = 0;
return(do_protocol(ctl, &imap));
}