comparison src/readpst.c @ 323:2474d01043cd stable-0-6-58

fix From quoting on embedded rfc/822 messages
author Carl Byington <carl@five-ten-sg.com>
date Fri, 28 Dec 2012 14:45:27 -0800
parents c4537664ff50
children c507af52515a
comparison
equal deleted inserted replaced
322:dda88a4e70dd 323:2474d01043cd
57 void find_html_charset(char *html, char *charset, size_t charsetlen); 57 void find_html_charset(char *html, char *charset, size_t charsetlen);
58 void find_rfc822_headers(char** extra_mime_headers); 58 void find_rfc822_headers(char** extra_mime_headers);
59 void write_body_part(FILE* f_output, pst_string *body, char *mime, char *charset, char *boundary, pst_file* pst); 59 void write_body_part(FILE* f_output, pst_string *body, char *mime, char *charset, char *boundary, pst_file* pst);
60 void write_schedule_part_data(FILE* f_output, pst_item* item, const char* sender, const char* method); 60 void write_schedule_part_data(FILE* f_output, pst_item* item, const char* sender, const char* method);
61 void write_schedule_part(FILE* f_output, pst_item* item, const char* sender, const char* boundary); 61 void write_schedule_part(FILE* f_output, pst_item* item, const char* sender, const char* boundary);
62 void write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, char** extra_mime_headers); 62 void write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, int embedding, char** extra_mime_headers);
63 void write_vcard(FILE* f_output, pst_item *item, pst_item_contact* contact, char comment[]); 63 void write_vcard(FILE* f_output, pst_item *item, pst_item_contact* contact, char comment[]);
64 int write_extra_categories(FILE* f_output, pst_item* item); 64 int write_extra_categories(FILE* f_output, pst_item* item);
65 void write_journal(FILE* f_output, pst_item* item); 65 void write_journal(FILE* f_output, pst_item* item);
66 void write_appointment(FILE* f_output, pst_item *item); 66 void write_appointment(FILE* f_output, pst_item *item);
67 void create_enter_dir(struct file_ll* f, pst_item *item); 67 void create_enter_dir(struct file_ll* f, pst_item *item);
343 pid_t child = try_fork(item->file_as.str); 343 pid_t child = try_fork(item->file_as.str);
344 if (child == 0) { 344 if (child == 0) {
345 // we are the child process, or the original parent if no children were available 345 // we are the child process, or the original parent if no children were available
346 pid_t me = getpid(); 346 pid_t me = getpid();
347 mk_separate_file(&ff, (mode_EX) ? ".eml" : "", 1); 347 mk_separate_file(&ff, (mode_EX) ? ".eml" : "", 1);
348 write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, &extra_mime_headers); 348 write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, 0, &extra_mime_headers);
349 close_separate_file(&ff); 349 close_separate_file(&ff);
350 if (mode_MSG) { 350 if (mode_MSG) {
351 mk_separate_file(&ff, ".msg", 0); 351 mk_separate_file(&ff, ".msg", 0);
352 write_msg_email(ff.name, item, &pstfile); 352 write_msg_email(ff.name, item, &pstfile);
353 } 353 }
365 #endif 365 #endif
366 } 366 }
367 } 367 }
368 else { 368 else {
369 // process this single email message, cannot fork since not separate mode 369 // process this single email message, cannot fork since not separate mode
370 write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, &extra_mime_headers); 370 write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, 0, &extra_mime_headers);
371 } 371 }
372 } 372 }
373 } 373 }
374 374
375 } else if (item->journal && (item->type == PST_TYPE_JOURNAL)) { 375 } else if (item->journal && (item->type == PST_TYPE_JOURNAL)) {
1099 if (!item->email) { 1099 if (!item->email) {
1100 DEBUG_WARN(("write_embedded_message: pst_parse_item returned type %d, not an email message", item->type)); 1100 DEBUG_WARN(("write_embedded_message: pst_parse_item returned type %d, not an email message", item->type));
1101 } else { 1101 } else {
1102 fprintf(f_output, "\n--%s\n", boundary); 1102 fprintf(f_output, "\n--%s\n", boundary);
1103 fprintf(f_output, "Content-Type: %s\n\n", attach->mimetype.str); 1103 fprintf(f_output, "Content-Type: %s\n\n", attach->mimetype.str);
1104 write_normal_email(f_output, "", item, MODE_NORMAL, 0, pf, save_rtf, extra_mime_headers); 1104 write_normal_email(f_output, "", item, MODE_NORMAL, 0, pf, save_rtf, 1, extra_mime_headers);
1105 } 1105 }
1106 pst_freeItem(item); 1106 pst_freeItem(item);
1107 } 1107 }
1108 1108
1109 DEBUG_RET(); 1109 DEBUG_RET();
1437 write_schedule_part_data(f_output, item, sender, method); 1437 write_schedule_part_data(f_output, item, sender, method);
1438 fprintf(f_output, "\n"); 1438 fprintf(f_output, "\n");
1439 } 1439 }
1440 1440
1441 1441
1442 void write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, char** extra_mime_headers) 1442 void write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, int embedding, char** extra_mime_headers)
1443 { 1443 {
1444 char boundary[60]; 1444 char boundary[60];
1445 char altboundary[66]; 1445 char altboundary[66];
1446 char *altboundaryp = NULL; 1446 char *altboundaryp = NULL;
1447 char body_charset[30]; 1447 char body_charset[30];
1562 if (mode != MODE_SEPARATE) { 1562 if (mode != MODE_SEPARATE) {
1563 // most modes need this separator line. 1563 // most modes need this separator line.
1564 // procmail produces this separator without the quotes around the 1564 // procmail produces this separator without the quotes around the
1565 // sender email address, but apparently some Mac email client needs 1565 // sender email address, but apparently some Mac email client needs
1566 // those quotes, and they don't seem to cause problems for anyone else. 1566 // those quotes, and they don't seem to cause problems for anyone else.
1567 fprintf(f_output, "From \"%s\" %s\n", sender, c_time); 1567 char *quo = (embedding) ? ">" : "";
1568 fprintf(f_output, "%sFrom \"%s\" %s\n", quo, sender, c_time);
1568 } 1569 }
1569 1570
1570 // print the supplied email headers 1571 // print the supplied email headers
1571 if (headers) { 1572 if (headers) {
1572 int len = strlen(headers); 1573 int len = strlen(headers);