diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-26 02:37:50 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-26 02:37:50 +0000 |
commit | 74631396d18f4c5b025e9cbbb70d0103c783037e (patch) | |
tree | e0fe83315284fa905cdecd51108a170815889cec /pop3.c | |
parent | ad0c91eabd0349b5f1468b52a9b37a6bb028841b (diff) | |
download | fetchmail-74631396d18f4c5b025e9cbbb70d0103c783037e.tar.gz fetchmail-74631396d18f4c5b025e9cbbb70d0103c783037e.tar.bz2 fetchmail-74631396d18f4c5b025e9cbbb70d0103c783037e.zip |
Added filtering by length. Ugh.
svn path=/trunk/; revision=390
Diffstat (limited to 'pop3.c')
-rw-r--r-- | pop3.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -186,7 +186,41 @@ int *countp, *newp; return(0); } +static int *pop3_getsizes(socket, count) +/* capture the sizes of all messages */ +int socket; +int count; +{ + int ok, *sizes; + + if ((ok = gen_transact(socket, "LIST")) != 0) + return((int *)NULL); + else if ((sizes = (int *)malloc(sizeof(int) * count)) == (int *)NULL) + return((int *)NULL); + else + { + char buf [POPBUFSIZE+1]; + + while (SockGets(socket, buf, sizeof(buf)) >= 0) + { + int num, size; + + if (outlevel == O_VERBOSE) + fprintf(stderr,"%s\n",buf); + if (buf[0] == '.') + break; + else if (sscanf(buf, "%d %d", &num, &size) == 2) + sizes[num - 1] = size; + else + sizes[num - 1] = -1; + } + + return(sizes); + } +} + static int pop3_is_old(socket, queryctl, num) +/* is the goiven message old? */ int socket; struct hostrec *queryctl; int num; @@ -240,6 +274,7 @@ const static struct method pop3 = pop3_ok, /* parse command response */ pop3_getauth, /* get authorization */ pop3_getrange, /* query range of messages */ + pop3_getsizes, /* we can get a list of sizes */ pop3_is_old, /* how do we tell a message is old? */ pop3_fetch, /* request given message */ NULL, /* no message trailer */ |