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>
Sun, 4 Sep 2011 21:46:56 +0000 (21:46 +0000)
  - don't output leading whitespace
  - don't output it at all if there is just whitespace inside.

citadel/msgbase.c

index c7a120f457ef018acfaf4c50aca08122ce798a4e..f78116711f164d5c3d4c76a04ed1cca280a8745f 100644 (file)
@@ -1955,6 +1955,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]) {
@@ -1980,7 +1981,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);