aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--imap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/imap.c b/imap.c
index 0ad0aa2b..ca9970fb 100644
--- a/imap.c
+++ b/imap.c
@@ -647,7 +647,7 @@ static int imap_getrange(int sock,
else
*newp = -1; /* should never happen, RECENT is mandatory */
- expunged = deletions = 0;
+ expunged = 0;
return(PS_SUCCESS);
}
@@ -826,6 +826,8 @@ static int imap_delete(int sock, struct query *ctl, int number)
: "STORE %d +FLAGS (\\Deleted)",
number)))
return(ok);
+ else
+ deletions++;
/*
* We do an expunge after ctl->expunge messages, rather than
@@ -833,7 +835,7 @@ static int imap_delete(int sock, struct query *ctl, int number)
* won't result in lots of messages being fetched again during
* the next session.
*/
- if (NUM_NONZERO(ctl->expunge) && (++deletions % ctl->expunge) == 0)
+ if (NUM_NONZERO(ctl->expunge) && (deletions % ctl->expunge) == 0)
{
if ((ok = gen_transact(sock, "EXPUNGE")))
return(ok);
@@ -843,6 +845,7 @@ static int imap_delete(int sock, struct query *ctl, int number)
#endif /* IMAP_UID */
expunged = deletions;
+ deletions = 0;
}
return(PS_SUCCESS);
@@ -859,6 +862,9 @@ static int imap_logout(int sock, struct query *ctl)
if ((ok = gen_transact(sock, "EXPUNGE")))
return(ok);
+ expunged = deletions;
+ deletions = 0;
+
#ifdef IMAP_UID /* not used */
expunge_uids(ctl);
#endif /* IMAP_UID */