On 01/30/99 Brandon Long uttered the following other thing:
> 
> I'll look into it, but I need to see the message?

Nevermind, I found it.  This patch contains the more correct fix.  The
problem is, we request a limited set of headers for the index, but we
need more headers when we actually view the message.  This adds a stage
where mutt re-parses the headers of the message when we download it, so
it catches everything.

Technically, we could fix this particular problem by adding the
Content-Transfer-Encoding to the FETCH stage where we're getting the
header index.  That doesn't help if there is any other header we need
later, or what not.  The problem with this is that it adds another parse
step on viewing a message.

Brandon
-- 
 Brandon Long             Chaos reigns within.
 MD6 Crash Test Dummy     Reflect, repent, and reboot.
 Intel Corporation        Order shall return.
 www.fiction.net/blong                -- Suzie Wagner
diff -ru mutt-0.95.1/imap.c mutt-0.95.1m2/imap.c
--- mutt-0.95.1/imap.c  Mon Dec 21 04:38:54 1998
+++ mutt-0.95.1m2/imap.c        Sun Jan 31 00:58:38 1999
@@ -35,6 +35,19 @@
 #include <sys/socket.h>
 #include <sys/stat.h>
 
+
+
+
+
+
+#ifdef _PGPPATH
+#include "pgp.h"
+#endif
+
+
+
+
+
 /* Minimal support for IMAP 4rev1 */
 
 #define IMAP_PORT 143
@@ -1103,7 +1116,7 @@
   char *pc;
   char *pn;
   long bytes;
-  int pos,len,onbody=0;
+  int pos, len;
   IMAP_CACHE *cache;
 
   /* see if we already have the message in our cache */
@@ -1177,18 +1190,6 @@
          pos += len;
          fputs (buf, msg->fp);
          fputs ("\n", msg->fp);
-         if (! onbody && len == 2)
-         {
-           /*
-            * This is the first time we really know how long the full
-            * header is. We must set it now, or mutt will not display
-            * the message properly
-            */
-           ctx->hdrs[msgno]->content->offset = ftell(msg->fp);
-           ctx->hdrs[msgno]->content->length = bytes - 
-             ctx->hdrs[msgno]->content->offset;
-           onbody=1;
-         }
        }
       }
       else if (imap_handle_untagged (ctx, buf) != 0)
@@ -1198,10 +1199,26 @@
   while (mutt_strncmp (buf, seq, SEQLEN) != 0)
     ;
 
-  mutt_clear_error();
-  
   if (!imap_code (buf))
     return (-1);
+
+  /* Update the header information.  Previously, we only downloaded a
+   * portion of the headers, those required for the main display.
+   */
+  rewind (msg->fp);
+  mutt_free_envelope (&ctx->hdrs[msgno]->env);
+  ctx->hdrs[msgno]->env = mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno],0);
+
+  /* This needs to be done in case this is a multipart message */
+#ifdef _PGPPATH
+  ctx->hdrs[msgno]->pgp = pgp_query (ctx->hdrs[msgno]->content);
+  if (!ctx->hdrs[msgno]->pgp)
+#endif /* _PGPPATH */
+    if (mutt_needs_mailcap (ctx->hdrs[msgno]->content))
+      ctx->hdrs[msgno]->mailcap = 1;
+
+  mutt_clear_error();
+  rewind (msg->fp);
 
   return 0;
 }

Reply via email to