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 /imap.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 'imap.c')
-rw-r--r-- | imap.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -12,7 +12,7 @@ #include "socket.h" #include "fetchmail.h" -static int count, seen; +static int count, seen, recent, unseen; int imap_ok (socket, argbuf) /* parse command response */ @@ -35,6 +35,10 @@ int socket; /* interpret untagged status responses */ if (strstr(buf, "EXISTS")) count = atoi(buf+2); + if (strstr(buf, "RECENT")) + recent = atoi(buf+2); + if (strstr(buf, "UNSEEN")) + unseen = atoi(buf+2); if (strstr(buf, "FLAGS")) seen = (strstr(buf, "Seen") != (char *)NULL); } while @@ -79,15 +83,16 @@ char *buf; queryctl->remotename, queryctl->password)); } -static imap_getrange(socket, queryctl, countp) +static imap_getrange(socket, queryctl, countp, newp) /* get range of messages to be fetched */ int socket; struct hostrec *queryctl; -int *countp; +int *countp, *newp; { int ok; /* find out how many messages are waiting */ + recent = unseen = 0; ok = gen_transact(socket, "SELECT %s", queryctl->mailbox[0] ? queryctl->mailbox : "INBOX"); @@ -96,6 +101,13 @@ int *countp; *countp = count; + if (unseen) /* optional response, but better if we see it */ + *newp = unseen; + else if (recent) /* mandatory */ + *newp = recent; + else + *newp = -1; /* should never happen, RECENT is mandatory */ + return(0); } |