Mercurial > libpst
comparison 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 |
comparison
equal
deleted
inserted
replaced
233:1d50ff3c5091 | 234:ed0cb66b23d4 |
---|---|
1318 headers = (item->email->header.str) ? item->email->header.str : *extra_mime_headers; | 1318 headers = (item->email->header.str) ? item->email->header.str : *extra_mime_headers; |
1319 | 1319 |
1320 // setup default body character set and report type | 1320 // setup default body character set and report type |
1321 strncpy(body_charset, pst_default_charset(item, sizeof(buffer_charset), buffer_charset), sizeof(body_charset)); | 1321 strncpy(body_charset, pst_default_charset(item, sizeof(buffer_charset), buffer_charset), sizeof(body_charset)); |
1322 body_charset[sizeof(body_charset)-1] = '\0'; | 1322 body_charset[sizeof(body_charset)-1] = '\0'; |
1323 body_report[0] = '\0'; | 1323 strncpy(body_report, "delivery-status", sizeof(body_report)); |
1324 if (item->email->report_text.str && !item->body.str) { | 1324 body_report[sizeof(body_report)-1] = '\0'; |
1325 strncpy(body_report, "delivery-status", sizeof(body_report)); | |
1326 } | |
1327 | 1325 |
1328 // setup default sender | 1326 // setup default sender |
1329 pst_convert_utf8(item, &item->email->sender_address); | 1327 pst_convert_utf8(item, &item->email->sender_address); |
1330 if (item->email->sender_address.str && strchr(item->email->sender_address.str, '@')) { | 1328 if (item->email->sender_address.str && strchr(item->email->sender_address.str, '@')) { |
1331 temp = item->email->sender_address.str; | 1329 temp = item->email->sender_address.str; |
1485 fprintf(f_output, "X-libpst-forensic-bcc: %s\n", item->email->bcc_address.str); | 1483 fprintf(f_output, "X-libpst-forensic-bcc: %s\n", item->email->bcc_address.str); |
1486 } | 1484 } |
1487 | 1485 |
1488 // add our own mime headers | 1486 // add our own mime headers |
1489 fprintf(f_output, "MIME-Version: 1.0\n"); | 1487 fprintf(f_output, "MIME-Version: 1.0\n"); |
1490 if (body_report[0] != '\0') { | 1488 if (item->type == PST_TYPE_REPORT) { |
1491 // multipart/report for DSN/MDN reports | 1489 // multipart/report for DSN/MDN reports |
1492 fprintf(f_output, "Content-Type: multipart/report; report-type=%s;\n\tboundary=\"%s\"\n", body_report, boundary); | 1490 fprintf(f_output, "Content-Type: multipart/report; report-type=%s;\n\tboundary=\"%s\"\n", body_report, boundary); |
1493 } | 1491 } |
1494 else { | 1492 else { |
1495 fprintf(f_output, "Content-Type: multipart/mixed;\n\tboundary=\"%s\"\n", boundary); | 1493 fprintf(f_output, "Content-Type: multipart/mixed;\n\tboundary=\"%s\"\n", boundary); |
1496 } | 1494 } |
1497 fprintf(f_output, "\n"); // end of headers, start of body | 1495 fprintf(f_output, "\n"); // end of headers, start of body |
1498 | 1496 |
1499 // now dump the body parts | 1497 // now dump the body parts |
1500 if ((item->email->report_text.str) && (body_report[0] != '\0')) { | 1498 if ((item->type == PST_TYPE_REPORT) && (item->email->report_text.str)) { |
1501 write_body_part(f_output, &item->email->report_text, "text/plain", body_charset, boundary, pst); | 1499 write_body_part(f_output, &item->email->report_text, "text/plain", body_charset, boundary, pst); |
1502 fprintf(f_output, "\n"); | 1500 fprintf(f_output, "\n"); |
1503 } | 1501 } |
1504 | 1502 |
1505 if (item->body.str && item->email->htmlbody.str) { | 1503 if (item->body.str && item->email->htmlbody.str) { |