diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-12-18 01:46:13 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-12-18 01:46:13 +0000 |
commit | f8990381199f4382fbab36851013ecb90f6befed (patch) | |
tree | a1b27342dfd0dcbb3a81959bc070deb09ecaaad5 | |
parent | 765e628df69ba9615473b60ea26e02353381e9ff (diff) | |
download | fetchmail-f8990381199f4382fbab36851013ecb90f6befed.tar.gz fetchmail-f8990381199f4382fbab36851013ecb90f6befed.tar.bz2 fetchmail-f8990381199f4382fbab36851013ecb90f6befed.zip |
Remodularize.
svn path=/trunk/; revision=1580
-rw-r--r-- | imap.c | 42 |
1 files changed, 18 insertions, 24 deletions
@@ -808,6 +808,22 @@ 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 */ { @@ -836,17 +852,7 @@ static int imap_delete(int sock, struct query *ctl, int number) * the next session. */ if (NUM_NONZERO(ctl->expunge) && (deletions % ctl->expunge) == 0) - { - if ((ok = gen_transact(sock, "EXPUNGE"))) - return(ok); - -#ifdef IMAP_UID /* not used */ - expunge_uids(ctl); -#endif /* IMAP_UID */ - - expunged = deletions; - deletions = 0; - } + internal_expunge(sock); return(PS_SUCCESS); } @@ -856,19 +862,7 @@ static int imap_logout(int sock, struct query *ctl) { /* if expunges after deletion have been suppressed, ship one now */ if (NUM_SPECIFIED(ctl->expunge) && NUM_ZERO(ctl->expunge) && deletions) - { - 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 */ - } + internal_expunge(sock); return(gen_transact(sock, "LOGOUT")); } |