diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-10 21:45:42 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-10 21:45:42 +0000 |
commit | 6e539dabb45ba4066f2bfbfa652b8bf375e8358e (patch) | |
tree | 533dd3834996672cf33b0ce0b9d65b2ee3f3b4c5 /pop3.c | |
parent | 473437ebe5a57fc2d4bfd782ecc004394f339033 (diff) | |
download | fetchmail-6e539dabb45ba4066f2bfbfa652b8bf375e8358e.tar.gz fetchmail-6e539dabb45ba4066f2bfbfa652b8bf375e8358e.tar.bz2 fetchmail-6e539dabb45ba4066f2bfbfa652b8bf375e8358e.zip |
UIDs, phase 2.
svn path=/trunk/; revision=287
Diffstat (limited to 'pop3.c')
-rw-r--r-- | pop3.c | 46 |
1 files changed, 43 insertions, 3 deletions
@@ -149,8 +149,29 @@ int *countp; gen_send(socket,"LAST"); ok = pop3_ok(socket, buf); - if (ok == 0 && sscanf(buf, "%d", &last) == 0) - return(PS_ERROR); + if (ok == 0) + { + if (sscanf(buf, "%d", &last) == 0) + return(PS_ERROR); + } + else + { + int num; + + /* grab the mailbox's UID list */ + gen_send(socket, "UIDL"); + if ((ok = pop3_ok(buf, socket)) == 0) { + while (SockGets(socket, buf, sizeof(buf)) >= 0) { + if (outlevel == O_VERBOSE) + fprintf(stderr,"%s\n",buf); + if (strcmp(buf, ".\n") == 0) { + break; + } + if (sscanf(buf, "%d %s\n", &num, id) == 2) + save_uid(&queryctl->unseen, num, id); + } + } + } } return(0); @@ -161,7 +182,26 @@ int socket; struct hostrec *queryctl; int num; { - return (num <= last); + if (!queryctl->saved) + return (num <= last); + else + { + char buf [POPBUFSIZE+1]; + int ok; + + gen_send(socket, "UIDL %d", num); + if ((ok = pop3_ok(socket, buf)) != 0) + return(ok); + else + { + char id[IDLEN+1]; + + if (sscanf(buf, "%*d %s", id) == 2) + return(uid_in_list(&queryctl->saved, id)); + else + return(0); + } + } } static int pop3_fetch(socket, number, lenp) |