diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-19 16:31:33 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-19 16:31:33 +0000 |
commit | 5bd3f8287149511024b95c01fb4212e60ec6fe13 (patch) | |
tree | 8ec93923109e7115160a3ad820f5843fc958e0e1 /pop3.c | |
parent | 73562230401b2cd48301805f03aee052927fadd2 (diff) | |
download | fetchmail-5bd3f8287149511024b95c01fb4212e60ec6fe13.tar.gz fetchmail-5bd3f8287149511024b95c01fb4212e60ec6fe13.tar.bz2 fetchmail-5bd3f8287149511024b95c01fb4212e60ec6fe13.zip |
Major improvements in --check processing. New-message count is now visible.
svn path=/trunk/; revision=353
Diffstat (limited to 'pop3.c')
-rw-r--r-- | pop3.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -115,11 +115,11 @@ char *greeting; return(0); } -static pop3_getrange(socket, queryctl, countp) +static pop3_getrange(socket, queryctl, countp, newp) /* get range of messages to be fetched */ int socket; struct hostrec *queryctl; -int *countp; +int *countp, *newp; { int ok; char buf [POPBUFSIZE+1]; @@ -137,8 +137,11 @@ int *countp; /* * Newer, RFC-1725-conformant POP servers may not have the LAST command. + * We work as hard as possible to hide this ugliness, but it makes + * counting new messages intrinsically quadratic in the worst case. */ last = 0; + *newp = -1; if (*countp > 0 && !queryctl->fetchall) { char id [IDLEN+1]; @@ -149,12 +152,15 @@ int *countp; { if (sscanf(buf, "%d", &last) == 0) return(PS_ERROR); + *newp = (*countp - last); } else { int num; + struct idlist *idp; /* grab the mailbox's UID list */ + *newp = 0; gen_send(socket, "UIDL"); if ((ok = pop3_ok(socket, buf)) == 0) { while (SockGets(socket, buf, sizeof(buf)) >= 0) { @@ -164,7 +170,11 @@ int *countp; break; } if (sscanf(buf, "%d %s", &num, id) == 2) + { save_uid(&queryctl->newsaved, num, id); + if (!uid_in_list(&queryctl->oldsaved, id)) + (*newp)++; + } } } } |