diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-09-14 20:14:54 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-09-14 20:14:54 +0000 |
commit | ddd0e2aa854c23ecdaf6e620f7fc38a81effbd1b (patch) | |
tree | cd1c47db8e596b2d467db87c9a0fa9957eda1463 | |
parent | 4e121fa43e2f4e85664da89c55d31ec70e2d5b5b (diff) | |
download | fetchmail-ddd0e2aa854c23ecdaf6e620f7fc38a81effbd1b.tar.gz fetchmail-ddd0e2aa854c23ecdaf6e620f7fc38a81effbd1b.tar.bz2 fetchmail-ddd0e2aa854c23ecdaf6e620f7fc38a81effbd1b.zip |
Simplify the length handling.
svn path=/trunk/; revision=1339
-rw-r--r-- | driver.c | 10 | ||||
-rw-r--r-- | etrn.c | 1 | ||||
-rw-r--r-- | fetchmail.h | 1 | ||||
-rw-r--r-- | imap.c | 5 | ||||
-rw-r--r-- | pop2.c | 1 | ||||
-rw-r--r-- | pop3.c | 19 |
6 files changed, 20 insertions, 17 deletions
@@ -1552,12 +1552,12 @@ const struct method *proto; /* protocol method table */ force_retrieval = !peek_capable && (ctl->errcount > 0); /* - * We may need to get sizes in order to check message - * limits. Or it may be forced because the fetch methods - * don't return reliable sizes. + * We need the size of each method before it's loaded in + * order to pass via the ESMTP SIZE option. If the protocol + * has a getsizes method, we presume this means it doesn't + * get reliable sizes from message fetch responses. */ - msgsizes = (int *)NULL; - if (proto->getsizes && (proto->force_getsizes || ctl->limit > 0)) + if (proto->getsizes) { msgsizes = (int *)alloca(sizeof(int) * count); @@ -153,7 +153,6 @@ const static struct method etrn = 25, /* standard SMTP port */ FALSE, /* this is not a tagged protocol */ FALSE, /* this does not use a message delimiter */ - FALSE, /* no getsizes method */ etrn_ok, /* parse command response */ NULL, /* no need to get authentication */ etrn_getrange, /* initialize message sending */ diff --git a/fetchmail.h b/fetchmail.h index 3fbb1cb9..9cc13b46 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -159,7 +159,6 @@ struct method int port; /* service port */ flag tagged; /* if true, generate & expect command tags */ flag delimited; /* if true, accept "." message delimiter */ - flag force_getsizes; /* if true, fetch's size return unreliable */ int (*parse_response)(); /* response_parsing function */ int (*getauth)(); /* authorization fetcher */ int (*getrange)(); /* get message range to fetch */ @@ -443,6 +443,7 @@ static int imap_getrange(int sock, return(PS_SUCCESS); } +#ifdef __UNUSED__ static int imap_getsizes(int sock, int count, int *sizes) /* capture the sizes of all messages */ { @@ -465,6 +466,7 @@ static int imap_getsizes(int sock, int count, int *sizes) return(PS_SUCCESS); } +#endif /* __UNUSED__ */ static int imap_is_old(int sock, struct query *ctl, int number) /* is the given message old? */ @@ -644,11 +646,10 @@ const static struct method imap = 143, /* standard IMAP2bis/IMAP4 port */ TRUE, /* this is a tagged protocol */ FALSE, /* no message delimiter */ - FALSE, /* fetch response size is reliable */ imap_ok, /* parse command response */ imap_getauth, /* get authorization */ imap_getrange, /* query range of messages */ - imap_getsizes, /* grab message sizes */ + NULL, /* we can get message sizes from individual messages */ imap_is_old, /* no UID check */ imap_fetch_headers, /* request given message headers */ imap_fetch_body, /* request given message body */ @@ -120,7 +120,6 @@ const static struct method pop2 = 109, /* standard POP2 port */ FALSE, /* this is not a tagged protocol */ FALSE, /* does not use message delimiter */ - FALSE, /* no getsizes method */ pop2_ok, /* parse command response */ pop2_getauth, /* get authorization */ pop2_getrange, /* query range of messages */ @@ -433,20 +433,26 @@ static int pop3_fetch(int sock, struct query *ctl, int number, int *lenp) #ifdef __UNUSED__ /* * Look for "nnn octets" -- there may or may not be preceding cruft. - * It's OK to punt and pass back -1 as a failure indication here, as - * long as the force_getsizes flag has forced sizes to be preloaded. + * This works with Eudora qpopper and some other common servers. + * It's OK to punt and pass back -1 as a failure indication here. */ - if ((cp = strstr(buf, " octets")) == (char *)NULL) - *lenp = -1; - else + if ((cp = strstr(buf, " octets")) != (char *)NULL) { while (--cp >= buf && isdigit(*cp)) continue; *lenp = atoi(++cp); } + else + *lenp = -1; #endif /* __UNUSED__ */ - *lenp = -1; /* POP3 is delimited, we don't care about lengths */ + /* + * POP3 is delimited, we don't care about lengths. + * Editorial comment: it's really bogus that standard POP3 + * doesn't give you a length in the fetch response, before + * the message. Even freakin' *POP2* got this right! + */ + *lenp = -1; return(0); } @@ -476,7 +482,6 @@ const static struct method pop3 = 110, /* standard POP3 port */ FALSE, /* this is not a tagged protocol */ TRUE, /* this uses a message delimiter */ - TRUE, /* RFC 1725 doesn't require a size field in fetch */ pop3_ok, /* parse command response */ pop3_getauth, /* get authorization */ pop3_getrange, /* query range of messages */ |