aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-01-23 17:37:47 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-01-23 17:37:47 +0000
commite702bc4457fe27fa096b5484c54d0733c9447126 (patch)
tree3b820f5850e7b37a739ccc3696efecda48ae2fbe
parentdc978c56e3fbbe9c8e3f8da4eef6c5fd3f8a509c (diff)
downloadfetchmail-e702bc4457fe27fa096b5484c54d0733c9447126.tar.gz
fetchmail-e702bc4457fe27fa096b5484c54d0733c9447126.tar.bz2
fetchmail-e702bc4457fe27fa096b5484c54d0733c9447126.zip
Correct deletion-counter handling on re-poll.
svn path=/trunk/; revision=1611
-rw-r--r--imap.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/imap.c b/imap.c
index b2028579..90a48f6f 100644
--- a/imap.c
+++ b/imap.c
@@ -580,6 +580,22 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
return(PS_SUCCESS);
}
+static int internal_expunge(int sock)
+/* ship an expunge, resetting associated counters */
+{
+ int ok;
+
+ if ((ok = gen_transact(sock, "EXPUNGE")))
+ return(ok);
+
+ expunged += deletions;
+ deletions = 0;
+
+#ifdef IMAP_UID /* not used */
+ expunge_uids(ctl);
+#endif /* IMAP_UID */
+}
+
static int imap_getrange(int sock,
struct query *ctl,
const char *folder,
@@ -599,11 +615,7 @@ static int imap_getrange(int sock,
*/
ok = 0;
if (deletions && ctl->expunge > 1)
- ok = gen_transact(sock, "EXPUNGE");
-#ifdef IMAP_UID /* not used */
- if (!ok)
- expunge_uids(ctl);
-#endif /* IMAP_UID */
+ internal_expunge(sock);
count = -1;
if (ok || gen_transact(sock, "NOOP"))
{
@@ -806,22 +818,6 @@ static int imap_trail(int sock, struct query *ctl, int number)
return(PS_SUCCESS);
}
-static int internal_expunge(int sock)
-/* ship an expunge, resetting associated counters */
-{
- int ok;
-
- if ((ok = gen_transact(sock, "EXPUNGE")))
- return(ok);
-
- expunged = deletions;
- deletions = 0;
-
-#ifdef IMAP_UID /* not used */
- expunge_uids(ctl);
-#endif /* IMAP_UID */
-}
-
static int imap_delete(int sock, struct query *ctl, int number)
/* set delete flag for given message */
{