aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-10-26 02:37:50 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-10-26 02:37:50 +0000
commit74631396d18f4c5b025e9cbbb70d0103c783037e (patch)
treee0fe83315284fa905cdecd51108a170815889cec /imap.c
parentad0c91eabd0349b5f1468b52a9b37a6bb028841b (diff)
downloadfetchmail-74631396d18f4c5b025e9cbbb70d0103c783037e.tar.gz
fetchmail-74631396d18f4c5b025e9cbbb70d0103c783037e.tar.bz2
fetchmail-74631396d18f4c5b025e9cbbb70d0103c783037e.zip
Added filtering by length. Ugh.
svn path=/trunk/; revision=390
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/imap.c b/imap.c
index 22f8db7c..c1dac5c8 100644
--- a/imap.c
+++ b/imap.c
@@ -111,6 +111,38 @@ int *countp, *newp;
return(0);
}
+static int *imap_getsizes(socket, count)
+/* capture the sizes of all messages */
+int socket;
+int count;
+{
+ int ok, *sizes;
+
+ if ((sizes = (int *)malloc(sizeof(int) * count)) == (int *)NULL)
+ return((int *)NULL);
+ else
+ {
+ char buf [POPBUFSIZE+1];
+
+ gen_send(socket, "FETCH 1:%d RFC822.SIZE", count);
+ while (SockGets(socket, buf, sizeof(buf)) >= 0)
+ {
+ int num, size;
+
+ if (outlevel == O_VERBOSE)
+ fprintf(stderr,"%s\n",buf);
+ if (strstr(buf, "OK"))
+ break;
+ else if (sscanf(buf, "* %d FETCH (RFC822.SIZE %d)", &num, &size) == 2)
+ sizes[num - 1] = size;
+ else
+ sizes[num - 1] = -1;
+ }
+
+ return(sizes);
+ }
+}
+
static imap_is_old(socket, queryctl, num)
int socket;
struct hostrec *queryctl;
@@ -181,6 +213,7 @@ const static struct method imap =
imap_ok, /* parse command response */
imap_getauth, /* get authorization */
imap_getrange, /* query range of messages */
+ imap_getsizes, /* grab message sizes */
imap_is_old, /* no UID check */
imap_fetch, /* request given message */
imap_trail, /* eat message trailer */