]> code.citadel.org Git - citadel.git/commitdiff
* plowing forward on imap
authorArt Cancro <ajc@citadel.org>
Sun, 8 Oct 2000 03:46:57 +0000 (03:46 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 8 Oct 2000 03:46:57 +0000 (03:46 +0000)
citadel/imap_fetch.c

index 980a6385d67a8d7129e3f3eee0d61389f3159a41..a7d0a2e36f6811ae43fd5861ab3011800bfe810c 100644 (file)
 #include "imap_fetch.h"
 
 
+/*
+ * imap_do_fetch() calls imap_do_fetch_msg() to output the deta of an
+ * individual message, once it has been successfully loaded from disk.
+ */
+void imap_do_fetch_msg(int seq, struct CtdlMessage *msg,
+                       int num_items, char **itemlist) {
+
+       cprintf("* %d FETCH ", seq);
+       /* FIXME obviously we must do something here */
+       cprintf("\r\n");
+}
+
+
 
 /*
- * Back end function.
+ * imap_fetch() calls imap_do_fetch() to do its actual work, once it's
+ * validated and boiled down the request a bit.
  */
 void imap_do_fetch(int lo, int hi, int num_items, char **itemlist) {
        int i;
+       struct CtdlMessage *msg;
 
-       cprintf("* imap_do_fetch() lo=%d hi=%d num_items=%d\r\n",
-               lo, hi, num_items);
-
-       for (i=0; i<num_items; ++i) {
+       /*for (i=0; i<num_items; ++i) {
                cprintf("* item[%d] = <%s>\r\n", i, itemlist[i]);
+       }*/
+
+       for (i = lo; i <= hi; ++i) {
+               msg = CtdlFetchMessage(IMAP->msgids[i-1]);
+               if (msg != NULL) {
+                       imap_do_fetch_msg(i, msg, num_items, itemlist);
+                       CtdlFreeMessage(msg);
+               }
+               else {
+                       cprintf("* %d FETCH <internal error>\r\n", i);
+               }
        }
 }
 
 
 
-
-
 /*
  * Break out the data items requested, possibly a parenthesized list.
  * Returns the number of data items, or -1 if the list is invalid.