diff src/readpst.c @ 234:ed0cb66b23d4

better detection of dsn delivery reports
author Carl Byington <carl@five-ten-sg.com>
date Fri, 11 Sep 2009 12:46:36 -0700
parents 1d50ff3c5091
children 093e0e9248bb
line wrap: on
line diff
--- a/src/readpst.c	Thu Sep 10 22:49:24 2009 -0700
+++ b/src/readpst.c	Fri Sep 11 12:46:36 2009 -0700
@@ -1320,10 +1320,8 @@
     // setup default body character set and report type
     strncpy(body_charset, pst_default_charset(item, sizeof(buffer_charset), buffer_charset), sizeof(body_charset));
     body_charset[sizeof(body_charset)-1] = '\0';
-    body_report[0] = '\0';
-    if (item->email->report_text.str && !item->body.str) {
-        strncpy(body_report, "delivery-status", sizeof(body_report));
-    }
+    strncpy(body_report, "delivery-status", sizeof(body_report));
+    body_report[sizeof(body_report)-1] = '\0';
 
     // setup default sender
     pst_convert_utf8(item, &item->email->sender_address);
@@ -1487,7 +1485,7 @@
 
     // add our own mime headers
     fprintf(f_output, "MIME-Version: 1.0\n");
-    if (body_report[0] != '\0') {
+    if (item->type == PST_TYPE_REPORT) {
         // multipart/report for DSN/MDN reports
         fprintf(f_output, "Content-Type: multipart/report; report-type=%s;\n\tboundary=\"%s\"\n", body_report, boundary);
     }
@@ -1497,7 +1495,7 @@
     fprintf(f_output, "\n");    // end of headers, start of body
 
     // now dump the body parts
-    if ((item->email->report_text.str) && (body_report[0] != '\0')) {
+    if ((item->type == PST_TYPE_REPORT) && (item->email->report_text.str)) {
         write_body_part(f_output, &item->email->report_text, "text/plain", body_charset, boundary, pst);
         fprintf(f_output, "\n");
     }