aboutsummaryrefslogtreecommitdiffstats
path: root/pop2.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-05-15 20:12:53 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-05-15 20:12:53 +0000
commitdea547a71036ae3445a5a612f6afd00b76ed721a (patch)
tree21526ebcd03d92a894cdb61b36d33ae56b8c5684 /pop2.c
parent3dd9a93bd23e0ad36e52ffd79efe2dcbdaf85272 (diff)
downloadfetchmail-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.c26
1 files changed, 16 insertions, 10 deletions
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;