From e076ea2f997f76f596a7f59defbb0867bf08035a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 25 Sep 2008 16:29:49 +0000 Subject: [PATCH] Completed HEADERS_FAST mode, which fetches only the top 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 | 4 ++-- citadel/modules/imap/imap_search.c | 2 +- citadel/modules/imap/serv_imap.c | 1 + citadel/modules/sieve/serv_sieve.c | 1 + citadel/msgbase.c | 7 +++---- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 436a4b243..a7a4f3fd3 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -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); } diff --git a/citadel/modules/imap/imap_search.c b/citadel/modules/imap/imap_search.c index 661a9001d..2bb5feeba 100644 --- a/citadel/modules/imap/imap_search.c +++ b/citadel/modules/imap/imap_search.c @@ -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) { diff --git a/citadel/modules/imap/serv_imap.c b/citadel/modules/imap/serv_imap.c index f09af1254..af02dd68c 100644 --- a/citadel/modules/imap/serv_imap.c +++ b/citadel/modules/imap/serv_imap.c @@ -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) diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index e8156501b..131b371ac 100644 --- a/citadel/modules/sieve/serv_sieve.c +++ b/citadel/modules/sieve/serv_sieve.c @@ -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; diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 8ae8a4d3d..e48dca901 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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 { -- 2.30.2