diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-05-15 20:12:53 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-05-15 20:12:53 +0000 |
commit | dea547a71036ae3445a5a612f6afd00b76ed721a (patch) | |
tree | 21526ebcd03d92a894cdb61b36d33ae56b8c5684 /pop2.c | |
parent | 3dd9a93bd23e0ad36e52ffd79efe2dcbdaf85272 (diff) | |
download | fetchmail-dea547a71036ae3445a5a612f6afd00b76ed721a.tar.gz fetchmail-dea547a71036ae3445a5a612f6afd00b76ed721a.tar.bz2 fetchmail-dea547a71036ae3445a5a612f6afd00b76ed721a.zip |
Add multiple-folder support.
svn path=/trunk/; revision=1012
Diffstat (limited to 'pop2.c')
-rw-r--r-- | pop2.c | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -58,26 +58,32 @@ int pop2_getauth(int sock, struct query *ctl, char *buf) ctl->remotename, ctl->password)); } -static int pop2_getrange(int sock, struct query *ctl, int*countp, int*newp) +static int pop2_getrange(int sock, struct query *ctl, const char *folder, int*countp, int*newp) /* get range of messages to be fetched */ { - /* - * We should have picked up a count of messages in the user's - * default inbox from the pop2_getauth() response. - */ - if (pound_arg == -1) - return(PS_ERROR); - /* maybe the user wanted a non-default folder */ - if (ctl->mailbox) + if (folder) { - int ok = gen_transact(sock, "FOLD %s", ctl->mailbox); + int ok = gen_transact(sock, "FOLD %s", folder); if (ok != 0) return(ok); if (pound_arg == -1) return(PS_ERROR); } + else + /* + * We should have picked up a count of messages in the user's + * default inbox from the pop2_getauth() response. + * + * Note: this logic only works because there is no way to select + * both the unnamed folder and named folders within a single + * fetchmail run. If that assumption ever becomes invalid, the + * pop2_getauth code will have to stash the pound response away + * explicitly in case it gets stepped on. + */ + if (pound_arg == -1) + return(PS_ERROR); *countp = pound_arg; *newp = -1; |