]> code.citadel.org Git - citadel.git/blobdiff - citadel/imap_fetch.c
* Backed out the variable-length string changes.
[citadel.git] / citadel / imap_fetch.c
index cb306ba22d0c494c3ef1eff2b1407cde24b74526..09a22bf1516849bb08888f89292fd74879bf6860 100644 (file)
@@ -49,20 +49,6 @@ struct imap_fetch_part {
        FILE *output_fp;
 };
 
-
-
-/* 
- * Output the flags associated with a message.  Note that this function
- * expects an index number in the array, *not* a sequence or uid number.
- */
-void imap_output_flags(int num) {
-       cprintf("FLAGS (");
-       if (IMAP->flags[num] & IMAP_DELETED) cprintf("\\Deleted");
-       cprintf(")");
-}
-
-
-
 /*
  * Individual field functions for imap_do_fetch_msg() ...
  */
@@ -73,6 +59,10 @@ void imap_fetch_uid(int seq) {
        cprintf("UID %ld", IMAP->msgids[seq-1]);
 }
 
+void imap_fetch_flags(struct CtdlMessage *msg) {
+       cprintf("FLAGS ()");    /* FIXME do something here */
+}
+
 void imap_fetch_internaldate(struct CtdlMessage *msg) {
        char buf[SIZ];
        time_t msgdate;
@@ -643,7 +633,7 @@ void imap_do_fetch_msg(int seq, struct CtdlMessage *msg,
                        imap_fetch_envelope(IMAP->msgids[seq-1], msg);
                }
                else if (!strcasecmp(itemlist[i], "FLAGS")) {
-                       imap_output_flags(seq-1);
+                       imap_fetch_flags(msg);
                }
                else if (!strcasecmp(itemlist[i], "INTERNALDATE")) {
                        imap_fetch_internaldate(msg);
@@ -682,7 +672,7 @@ void imap_do_fetch(int num_items, char **itemlist) {
 
        if (IMAP->num_msgs > 0)
         for (i = 0; i < IMAP->num_msgs; ++i)
-         if (IMAP->flags[i] & IMAP_SELECTED) {
+         if (IMAP->flags[i] & IMAP_FETCHED) {
                msg = CtdlFetchMessage(IMAP->msgids[i]);
                if (msg != NULL) {
                        imap_do_fetch_msg(i+1, msg, num_items, itemlist);
@@ -823,14 +813,14 @@ int imap_extract_data_items(char **argv, char *items) {
 /*
  * One particularly hideous aspect of IMAP is that we have to allow the client
  * to specify arbitrary ranges and/or sets of messages to fetch.  Citadel IMAP
- * handles this by setting the IMAP_SELECTED flag for each message specified in
+ * handles this by setting the IMAP_FETCHED flag for each message specified in
  * the ranges/sets, then looping through the message array, outputting messages
  * with the flag set.  We don't bother returning an error if an out-of-range
  * number is specified (we just return quietly) because any client braindead
  * enough to request a bogus message number isn't going to notice the
  * difference anyway.
  *
- * This function clears out the IMAP_SELECTED bits, then sets that bit for each
+ * This function clears out the IMAP_FETCHED bits, then sets that bit for each
  * message included in the specified range.
  *
  * Set is_uid to 1 to fetch by UID instead of sequence number.
@@ -854,10 +844,10 @@ void imap_pick_range(char *supplied_range, int is_uid) {
        }
 
        /*
-        * Clear out the IMAP_SELECTED flags for all messages.
+        * Clear out the IMAP_FETCHED flags for all messages.
         */
        for (i = 0; i < IMAP->num_msgs; ++i) {
-               IMAP->flags[i] = IMAP->flags[i] & ~IMAP_SELECTED;
+               IMAP->flags[i] = IMAP->flags[i] & ~IMAP_FETCHED;
        }
 
        /*
@@ -884,13 +874,13 @@ void imap_pick_range(char *supplied_range, int is_uid) {
                                if ( (IMAP->msgids[i-1]>=lo)
                                   && (IMAP->msgids[i-1]<=hi)) {
                                        IMAP->flags[i-1] =
-                                               IMAP->flags[i-1] | IMAP_SELECTED;
+                                               IMAP->flags[i-1] | IMAP_FETCHED;
                                }
                        }
                        else {          /* fetch by uid */
                                if ( (i>=lo) && (i<=hi)) {
                                        IMAP->flags[i-1] =
-                                               IMAP->flags[i-1] | IMAP_SELECTED;
+                                               IMAP->flags[i-1] | IMAP_FETCHED;
                                }
                        }
                }
@@ -902,7 +892,7 @@ void imap_pick_range(char *supplied_range, int is_uid) {
        for (i = 0; i < IMAP->num_msgs; ++i) {
                if (IMAP->flags[i] & IMAP_EXPUNGED) {
                        lprintf(9, "eliminating %d because expunged\n", i);
-                       IMAP->flags[i] = IMAP->flags[i] & ~IMAP_SELECTED;
+                       IMAP->flags[i] = IMAP->flags[i] & ~IMAP_FETCHED;
                }
        }