diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2003-10-15 19:26:58 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2003-10-15 19:26:58 +0000 |
commit | 0d8a8b913f6a15088523bc69cbcf6240de945cda (patch) | |
tree | 6d32025f03e7c273d35d88a6bd4c6fa9432632d8 /imap.c | |
parent | a9c74c7425861cabc87f74fbce49e0da7af5e756 (diff) | |
download | fetchmail-0d8a8b913f6a15088523bc69cbcf6240de945cda.tar.gz fetchmail-0d8a8b913f6a15088523bc69cbcf6240de945cda.tar.bz2 fetchmail-0d8a8b913f6a15088523bc69cbcf6240de945cda.zip |
Sunil's transaction patches.
svn path=/trunk/; revision=3858
Diffstat (limited to 'imap.c')
-rw-r--r-- | imap.c | 32 |
1 files changed, 20 insertions, 12 deletions
@@ -785,8 +785,8 @@ static int imap_getrange(int sock, return(PS_SUCCESS); } -static int imap_getsizes(int sock, int count, int *sizes) -/* capture the sizes of all messages */ +static int imap_getpartialsizes(int sock, int first, int last, int *sizes) +/* capture the sizes of messages #first-#last */ { char buf [MSGBUFSIZE+1]; @@ -824,14 +824,15 @@ static int imap_getsizes(int sock, int count, int *sizes) * on the fact that the sizes array has been preinitialized with a * known-bad size value. */ - /* if fetchall is specified, startcount is 1; - * else if there is new mail, startcount is first unseen message; - * else startcount is greater than count. - */ - if (count == startcount) - gen_send(sock, "FETCH %d RFC822.SIZE", count); - else if (count > startcount) - gen_send(sock, "FETCH %d:%d RFC822.SIZE", startcount, count); + + /* expunges change the fetch numbers */ + first -= expunged; + last -= expunged; + + if (last == first) + gen_send(sock, "FETCH %d RFC822.SIZE", last); + else if (last > first) + gen_send(sock, "FETCH %d:%d RFC822.SIZE", first, last); else /* no unseen messages! */ return(PS_SUCCESS); for (;;) @@ -852,8 +853,8 @@ static int imap_getsizes(int sock, int count, int *sizes) break; else if (sscanf(buf, "* %u FETCH (RFC822.SIZE %u)", &num, &size) == 2) { - if (num > 0 && num <= count) - sizes[num - 1] = size; + if (num >= first && num <= last) + sizes[num - first] = size; else report(stderr, "Warning: ignoring bogus data for message sizes returned by the server.\n"); } @@ -862,6 +863,12 @@ static int imap_getsizes(int sock, int count, int *sizes) return(PS_SUCCESS); } +static int imap_getsizes(int sock, int count, int *sizes) +/* capture the sizes of all messages */ +{ + return imap_getpartialsizes(sock, 1, count, sizes); +} + static int imap_is_old(int sock, struct query *ctl, int number) /* is the given message old? */ { @@ -1119,6 +1126,7 @@ const static struct method imap = imap_getauth, /* get authorization */ imap_getrange, /* query range of messages */ imap_getsizes, /* get sizes of messages (used for ESMTP SIZE option) */ + imap_getpartialsizes, /* get sizes of subset of messages (used for ESMTP SIZE option) */ imap_is_old, /* no UID check */ imap_fetch_headers, /* request given message headers */ imap_fetch_body, /* request given message body */ |