aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2002-02-01 02:14:24 +0000
committerEric S. Raymond <esr@thyrsus.com>2002-02-01 02:14:24 +0000
commitc260a67eb2a4a93567a7a975b6ebe92204fc9b49 (patch)
tree03123e6a4363b31c44239239634dea9abdde52bc /imap.c
parent4482579b645d64cf43f5da9b44b05ae0cdf34776 (diff)
downloadfetchmail-c260a67eb2a4a93567a7a975b6ebe92204fc9b49.tar.gz
fetchmail-c260a67eb2a4a93567a7a975b6ebe92204fc9b49.tar.bz2
fetchmail-c260a67eb2a4a93567a7a975b6ebe92204fc9b49.zip
Before the next fix round.
svn path=/trunk/; revision=3569
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/imap.c b/imap.c
index 9a22a37c..9043a9ad 100644
--- a/imap.c
+++ b/imap.c
@@ -29,8 +29,9 @@ 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, unseen, deletions, imap_version, preauth;
-static int expunged, expunge_period, saved_timeout;
+static int count, unseen, deletions = 0;
+static int expunged, expunge_period, saved_timeout = 0;
+static int imap_version, preauth;
static flag do_idle;
static char capabilities[MSGBUFSIZE+1];
static unsigned int *unseen_messages;
@@ -519,6 +520,23 @@ static int imap_getrange(int sock,
/* no messages? then we may need to idle until we get some */
if (count == 0 && do_idle)
imap_idle(sock);
+
+ /*
+ * We should have an expunge here to
+ * a) avoid fetching deleted mails during 'fetchall'
+ * b) getting a wrong count of mails during 'no fetchall'
+ */
+ if (!check_only && !ctl->keep && count > 0)
+ {
+ ok = internal_expunge(sock);
+ if (ok)
+ {
+ report(stderr, GT_("expunge failed\n"));
+ return(ok);
+ }
+ if (outlevel >= O_DEBUG)
+ report(stdout, GT_("%d messages waiting after expunge\n"), count);
+ }
}
*countp = count;
@@ -576,6 +594,7 @@ static int imap_getrange(int sock,
*newp = unseen;
expunged = 0;
+ deletions = 0;
return(PS_SUCCESS);
}