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 10:12:21 +0000 (10:12 +0000)
  - don't output leading whitespace
  - don't output it at all if there is just whitespace inside.

citadel/msgbase.c

index 1313efda997e80c4c07d5f240ba3a616dd7b2245..d3693643ef14206a9eaba87d71aeb429e20cb24e 100644 (file)
@@ -1923,6 +1923,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]) {
@@ -1948,7 +1949,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);