]> granicus.if.org Git - mutt/commitdiff
Don't output empty header fields. This is made necessary by the
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Feb 2000 14:05:08 +0000 (14:05 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Feb 2000 14:05:08 +0000 (14:05 +0000)
addition of possibly empty my_hdr commands.

sendlib.c

index 2f1574c04482bf57cada5110982081b6d274655a..f61807917f4b7de4b8e5759fc784946ed4a72c2b 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1274,6 +1274,7 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach,
                              int mode, int privacy)
 {
   char buffer[LONG_STRING];
+  char *p;
   LIST *tmp = env->userhdrs;
   
   if (mode == 0 && !privacy)
@@ -1362,8 +1363,14 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach,
   /* Add any user defined headers */
   for (; tmp; tmp = tmp->next)
   {
-    fputs (tmp->data, fp);
-    fputc ('\n', fp);
+    if ((p = strchr (tmp->data, ':')))
+    {
+      p++; SKIPWS (p);
+      if (!*p)         continue;  /* don't emit empty fields. */
+
+      fputs (tmp->data, fp);
+      fputc ('\n', fp);
+    }
   }
 
   return (ferror (fp) == 0 ? 0 : -1);