Completed HEADERS_FAST mode, which fetches only the top
authorArt Cancro <ajc@citadel.org>
Thu, 25 Sep 2008 16:29:49 +0000 (16:29 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 25 Sep 2008 16:29:49 +0000 (16:29 +0000)
level headers.  HEADERS_ONLY loads the message body in order to
retrieve the second level headers.  IMAP is using HEADERS_FAST and
Sieve is using HEADERS_ONLY.

citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_search.c
citadel/modules/imap/serv_imap.c
citadel/modules/sieve/serv_sieve.c
citadel/msgbase.c

index 436a4b243857d8c6bcee53635911e00c45cc8a6b..a7a4f3fd3cba6c10d0d42154cfe5de83dc1ce0c2 100644 (file)
@@ -174,7 +174,7 @@ void imap_fetch_rfc822(long msgnum, char *whichfmt) {
                CC->redirect_len = 0;
                CC->redirect_alloc = SIZ;
                CtdlOutputMsg(msgnum, MT_RFC822,
-                       (need_body ? HEADERS_ALL : HEADERS_ONLY),
+                       (need_body ? HEADERS_ALL : HEADERS_FAST),
                              0, 1, NULL, 0);
                if (!need_body) cprintf("\r\n");        /* extra trailing newline */
                IMAP->cached_rfc822_data = CC->redirect_buffer;
@@ -663,7 +663,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) {
         * fields, strip it down.
         */
        else if (!strncasecmp(section, "HEADER", 6)) {
-               CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1, 0);
+               CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_FAST, 0, 1, 0);
                imap_strip_headers(section);
        }
 
index 661a9001d60dade67ca3aa65062f22aa30ba43e6..2bb5feebad8768e94051e4509717a6d561633272 100644 (file)
@@ -241,7 +241,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                        CC->redirect_buffer = malloc(SIZ);
                        CC->redirect_len = 0;
                        CC->redirect_alloc = SIZ;
-                       CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1, 0);
+                       CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_FAST, 0, 1, 0);
        
                        fieldptr = rfc822_fetch_field(CC->redirect_buffer, itemlist[pos+1]);
                        if (fieldptr != NULL) {
index f09af1254ecb219d291d687e9d2e38a58d9be12a..af02dd68cb4da83c8c9cc08401c91ca0ecf760f8 100644 (file)
@@ -1632,6 +1632,7 @@ void imap_command_loop(void)
 
        gettimeofday(&tv2, NULL);
        total_time = (tv2.tv_usec + (tv2.tv_sec * 1000000)) - (tv1.tv_usec + (tv1.tv_sec * 1000000));
+       CtdlLogPrintf(CTDL_INFO, "IMAP: %s\n", cmdbuf); // FIXME FIXME FIXME REMOVE THIS NOW
        CtdlLogPrintf(CTDL_DEBUG, "IMAP command completed in %ld.%ld seconds\n",
                (total_time / 1000000),
                (total_time % 1000000)
index e8156501b35b6d436727485cf2ea0e2ca3de72ef..131b371acf52d0600e99c838b7376bb051365b40 100644 (file)
@@ -523,6 +523,7 @@ void sieve_do_msg(long msgnum, void *userdata) {
 
        /*
         * Grab the message headers so we can feed them to libSieve.
+        * Use HEADERS_ONLY rather than HEADERS_FAST in order to include second-level headers.
         */
        CC->redirect_buffer = malloc(SIZ);
        CC->redirect_len = 0;
index 8ae8a4d3d9b948d01f2f755aa7476ded047807a8..e48dca90193a79e6d7ef841ef69bd9a355e3548b 100644 (file)
@@ -1417,11 +1417,10 @@ int CtdlOutputMsg(long msg_num,         /* message number (local) to fetch */
        /* FIXME: check message id against msglist for this room */
 
        /*
-        * Fetch the message from disk.  If we're in any sort of headers
-        * only mode, request that we don't even bother loading the body
-        * into memory.
+        * Fetch the message from disk.  If we're in HEADERS_FAST mode,
+        * request that we don't even bother loading the body into memory.
         */
-       if ( (headers_only == HEADERS_FAST) || (headers_only == HEADERS_ONLY) ) {
+       if (headers_only == HEADERS_FAST) {
                TheMessage = CtdlFetchMessage(msg_num, 0);
        }
        else {