Fix envelope-to header.
authorWilfried Goesgens <dothebart@citadel.org>
Wed, 17 Aug 2011 10:12:21 +0000 (10:12 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Wed, 17 Aug 2011 12:06:53 +0000 (12:06 +0000)
  - don't output leading whitespace
  - don't output it at all if there is just whitespace inside.

citadel/msgbase.c

index abdacccb5af75008c9885f99ad61ce85f0e1622f..b29980a5d558441670d70e77a0ef15276bd16b2d 100644 (file)
@@ -1814,6 +1814,7 @@ void OutputRFC822MsgHeaders(
        int i, j, k;
        char *mptr = NULL;
        char *mpptr = NULL;
+       char *hptr;
 
        for (i = 0; i < 256; ++i) {
                if (TheMessage->cm_fields[i]) {
@@ -1839,7 +1840,11 @@ void OutputRFC822MsgHeaders(
                        else if (i == 'V') {
                                if ((flags & QP_EADDR) != 0) 
                                        mptr = qp_encode_email_addrs(mptr);
-                               cprintf("Envelope-To: %s%s", mptr, nl);
+                               hptr = mptr;
+                               while ((*hptr != '\0') && isspace(*hptr))
+                                       hptr ++;
+                               if (!IsEmptyStr(hptr))
+                                       cprintf("Envelope-To: %s%s", hptr, nl);
                        }
                        else if (i == 'U') {
                                cprintf("Subject: %s%s", mptr, nl);