From dea547a71036ae3445a5a612f6afd00b76ed721a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 15 May 1997 20:12:53 +0000 Subject: Add multiple-folder support. svn path=/trunk/; revision=1012 --- pop2.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'pop2.c') diff --git a/pop2.c b/pop2.c index 88140a3d..1f04a4ce 100644 --- a/pop2.c +++ b/pop2.c @@ -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; -- cgit v1.2.3