]> code.citadel.org Git - citadel.git/commitdiff
* imap_fetch.c: don't fetch the message from disk at all for UID and FLAGS
authorArt Cancro <ajc@citadel.org>
Sat, 13 Mar 2004 23:26:10 +0000 (23:26 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 13 Mar 2004 23:26:10 +0000 (23:26 +0000)
  fetch items.  (It's rare, but sometimes IMAP optimizations are actually
  possible, despite Mark DIE DIE DIE Crispin's brain-dead design!)

citadel/ChangeLog
citadel/imap_fetch.c

index 0ea02887ca1d80e583d7fbecc9461da66d69bd23..9ad9eb9838c44d7464b4703e106dad937af5a06c 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 614.75  2004/03/13 23:26:10  ajc
+ * imap_fetch.c: don't fetch the message from disk at all for UID and FLAGS
+   fetch items.  (It's rare, but sometimes IMAP optimizations are actually
+   possible, despite Mark DIE DIE DIE Crispin's brain-dead design!)
+
  Revision 614.74  2004/03/13 22:52:05  ajc
  * Documented the GNET and SNET commands  :)
 
@@ -5493,4 +5498,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index a4e84adf17edee0cd6825e0a3275633e22bf4cf2..159280bc9ee020235cf5153942f4493b6388e9e9 100644 (file)
@@ -869,7 +869,18 @@ void imap_do_fetch_msg(int seq,
 
        for (i=0; i<num_items; ++i) {
 
-               if (!strcasecmp(itemlist[i], "RFC822")) {
+               /* Fetchable without going to the message store at all */
+               if (!strcasecmp(itemlist[i], "UID")) {
+                       imap_fetch_uid(seq);
+               }
+               else if (!strcasecmp(itemlist[i], "FLAGS")) {
+                       imap_fetch_flags(seq-1);
+               }
+
+               /* Potentially fetchable from cache, if the client requests
+                * stuff from the same message several times in a row.
+                */
+               else if (!strcasecmp(itemlist[i], "RFC822")) {
                        imap_fetch_rfc822(IMAP->msgids[seq-1], itemlist[i]);
                }
                else if (!strcasecmp(itemlist[i], "RFC822.HEADER")) {
@@ -882,7 +893,8 @@ void imap_do_fetch_msg(int seq,
                        imap_fetch_rfc822(IMAP->msgids[seq-1], itemlist[i]);
                }
 
-               /* Not an RFC822.* fetch item?  Load the message into memory. */
+               /* Otherwise, load the message into memory.
+                */
                msg = CtdlFetchMessage(IMAP->msgids[seq-1]);
                if (!strncasecmp(itemlist[i], "BODY[", 5)) {
                        imap_fetch_body(IMAP->msgids[seq-1], itemlist[i],
@@ -899,15 +911,9 @@ void imap_do_fetch_msg(int seq,
                else if (!strcasecmp(itemlist[i], "ENVELOPE")) {
                        imap_fetch_envelope(IMAP->msgids[seq-1], msg);
                }
-               else if (!strcasecmp(itemlist[i], "FLAGS")) {
-                       imap_fetch_flags(seq-1);
-               }
                else if (!strcasecmp(itemlist[i], "INTERNALDATE")) {
                        imap_fetch_internaldate(msg);
                }
-               else if (!strcasecmp(itemlist[i], "UID")) {
-                       imap_fetch_uid(seq);
-               }
 
                if (i != num_items-1) cprintf(" ");
        }