From 36159e7494bd14e0e19584cc5593c0bb5e902609 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 22 Aug 1996 16:08:03 +0000 Subject: Change the LAST logic slightly, preparatory to using UIDL. svn path=/trunk/; revision=55 --- pop3.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pop3.c b/pop3.c index 5571d6d9..adb865cf 100644 --- a/pop3.c +++ b/pop3.c @@ -121,15 +121,16 @@ struct hostrec *queryctl; goto cleanUp; } - /* Ask for number of last message retrieved */ - if (queryctl->fetchall) - first = 1; - else { + /* + * Ask for number of last message retrieved. + * Newer, RFC-1760-conformant POP servers may not have the LAST command. + * Therefore we don't croak if we get a nonzero return. + */ + first = 1; + if (!queryctl->fetchall) { ok = POP3_sendLAST(&first, socket); - if (ok != 0) - goto cleanUp; - - first++; + if (ok == 0) + first++; } /* show them how many messages we'll be downloading */ @@ -138,14 +139,12 @@ struct hostrec *queryctl; fprintf(stderr,"%d messages in folder, %d new messages.\n", count, count - first + 1); else - fprintf(stderr,"%d new messages in folder.\n", count); + fprintf(stderr,"%d %smessages in folder.\n", count, ok ? "" : "new "); else ; if (count > 0) { - for (number = (queryctl->flush || queryctl->fetchall)? 1 : first; - number <= count; - number++) { + for (number = queryctl->flush ? 1 : first; number <= count; number++) { /* open the mail pipe if we're using an MDA */ if (queryctl->output == TO_MDA -- cgit v1.2.3