Subject: patch for horde/imp

From: Egan <[email-masked]>
Date: Thu, 07 Jun 2001 12:31:29 -0400

Hi,

I have a patch to imap4r1.[ch] which improves tcp performance when
horde/imp uses c-client.

It adds one fetch option and two search options to the .h file.  The
changes to the .c file are transparent; behaviour is unchanged for any
user not specifying the new options.

The patch is against imap-2000.  It is simple, so presumably it would
apply easily to the current version.

Would you consider accepting the patch?

Egan

--- src/c-client/mail.h	Tue Oct 24 18:11:40 2000
+++ src/c-client/mail.h	Thu Jun  7 10:21:29 2001
@@ -329,6 +329,7 @@
 #define FT_NOT (long) 4		/* NOT flag for header lines fetch */
 #define FT_INTERNAL (long) 8	/* text can be internal strings */
 #define FT_PREFETCHTEXT (long) 16 /* IMAP prefetch text when fetching header */
+#define FT_EXCLHDR (long) 32768	/* exclude headers */

 /* Flagging options */
@@ -353,6 +354,8 @@
 #define SO_NOSERVER (long) 16	/* don't do server-based sort */
 #define SE_RETAIN (long) 32	/* retain previous search results */
 #define SO_OVERVIEW (long) 64	/* use overviews in searching (NNTP only) */
+#define SE_INCLBST (long) 16384	/* include BODYSTRUCTURE prefetching */
+#define SE_EXCLHDR (long) 32768	/* exclude headers prefetching */

 /* Status options */
--- src/c-client/imap4r1.c	Tue Oct 24 18:12:58 2000
+++ src/c-client/imap4r1.c	Thu Jun  7 10:23:43 2001
@@ -1184,7 +1184,8 @@
 				/* IMAP UID fetching is a special case */
   if (LEVELIMAP4 (stream) && (flags & FT_UID)) {
     strcpy (tmp,allheader);
-    if (LEVELIMAP4rev1(stream)){/* get extra headers if IMAP4rev1 */
+				/* get extra headers if IMAP4rev1 */
+    if (LEVELIMAP4rev1(stream) && !(flags & FT_EXCLHDR)){
       if (imap_extrahdrs) sprintf (tmp + strlen (tmp)," %s %s %s",
 				   hdrheader,imap_extrahdrs,hdrtrailer);
       else sprintf (tmp + strlen (tmp)," %s %s",hdrheader,hdrtrailer);
@@ -1548,10 +1549,13 @@
       aseq.text = (void *) cpystr (LOCAL->tmp);
       if (LEVELIMAP4 (stream)) {/* IMAP4 fetching does more */
 	strcpy (tmp,allheader);
-	if (LEVELIMAP4rev1 (stream)) {
+	if (LEVELIMAP4rev1 (stream) && !(flags & SE_EXCLHDR)) {
 	  if (imap_extrahdrs) sprintf (tmp + strlen (tmp)," %s %s %s",
 				       hdrheader,imap_extrahdrs,hdrtrailer);
 	  else sprintf (tmp + strlen (tmp)," %s %s",hdrheader,hdrtrailer);
+	}
+	if (flags & SE_INCLBST) {
+          strcat (tmp," BODYSTRUCTURE");
 	}
 	sprintf (tmp + strlen (tmp)," %s",fasttrailer);
 	aatt.text = (void *) tmp;