diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-09-25 02:29:50 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-09-25 02:29:50 +0000 |
commit | 35e28194eeb4e296d130305552e768d467cb6220 (patch) | |
tree | 3d33dfdec9e21469fa7b260c16f01ae84bed51e8 | |
parent | 281cff65bf8c2c87ad995379efc27b3a57ea2888 (diff) | |
download | fetchmail-35e28194eeb4e296d130305552e768d467cb6220.tar.gz fetchmail-35e28194eeb4e296d130305552e768d467cb6220.tar.bz2 fetchmail-35e28194eeb4e296d130305552e768d467cb6220.zip |
Another simplification.
svn path=/trunk/; revision=131
-rw-r--r-- | pop3.c | 46 |
1 files changed, 7 insertions, 39 deletions
@@ -19,7 +19,6 @@ #ifdef HAVE_PROTOTYPES /* prototypes for internal functions */ -int POP3_sendSTAT (int *msgcount, int socket); int POP3_sendUIDL (int num, int socket, char **cp); int POP3_BuildDigest (char *buf, struct hostrec *options); #endif @@ -149,11 +148,15 @@ int *countp; int *firstp; { int ok; + char buf [POPBUFSIZE+1]; - ok = POP3_sendSTAT(countp,socket); - if (ok != 0) { + /* get the total message count */ + gen_send(socket, "STAT"); + ok = pop3_ok(buf,socket); + if (ok == 0) + sscanf(buf,"%d %*d", countp); + else return(ok); - } /* * Ask for number of last message retrieved. @@ -165,7 +168,6 @@ int *firstp; *firstp = 1; use_uidl = 0; if (!queryctl->fetchall) { - char buf [POPBUFSIZE+1]; char id [IDLEN+1]; int num; @@ -257,40 +259,6 @@ struct hostrec *queryctl; return(do_protocol(queryctl, &pop3)); } -/********************************************************************* - function: POP3_sendSTAT - description: send the STAT command to the POP3 server to find - out how many messages are waiting. - arguments: - count pointer to an integer to receive the message count. - socket socket to which the POP3 server is connected. - - return value: return code from POP3_OK. - calls: POP3_OK, SockPrintf - globals: reads outlevel. - *********************************************************************/ - -int POP3_sendSTAT (msgcount,socket) -int *msgcount; -int socket; -{ - int ok; - char buf [POPBUFSIZE+1]; - int totalsize; - - SockPrintf(socket,"STAT\r\n"); - if (outlevel == O_VERBOSE) - fprintf(stderr,"> STAT\n"); - - ok = pop3_ok(buf,socket); - if (ok == 0) - sscanf(buf,"%d %d",msgcount,&totalsize); - else if (outlevel > O_SILENT && outlevel < O_VERBOSE) - fprintf(stderr,"%s\n",buf); - - return(ok); -} - /****************************************************************** function: POP3_sendUIDL description: send the UIDL command to the server, |