From e702bc4457fe27fa096b5484c54d0733c9447126 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 23 Jan 1998 17:37:47 +0000 Subject: Correct deletion-counter handling on re-poll. svn path=/trunk/; revision=1611 --- imap.c | 38 +++++++++++++++++--------------------- 1 file 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 */ { -- cgit v1.2.3