comparison src/pst2dii.cpp.in @ 167:40e9de445038

improve consistency checking when fetching items from the pst file. avoid putting mixed item types into the same output folder.
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Mar 2009 22:31:18 -0700
parents 6cb85306e28a
children 0e1e048716e4
comparison
equal deleted inserted replaced
166:55d4f17a35f2 167:40e9de445038
202 } 202 }
203 DEBUG_EMAIL(("Saving attachment to %s\n", temp)); 203 DEBUG_EMAIL(("Saving attachment to %s\n", temp));
204 if (!(fp = fopen(temp, "wb"))) { 204 if (!(fp = fopen(temp, "wb"))) {
205 WARN(("write_separate_attachment: Cannot open attachment save file \"%s\"\n", temp)); 205 WARN(("write_separate_attachment: Cannot open attachment save file \"%s\"\n", temp));
206 } else { 206 } else {
207 if (current_attach->data) 207 if (current_attach->data.data)
208 pst_fwrite(current_attach->data, 1, current_attach->size, fp); 208 pst_fwrite(current_attach->data.data, 1, current_attach->data.size, fp);
209 else { 209 else {
210 (void)pst_attach_to_file(pst, current_attach, fp); 210 (void)pst_attach_to_file(pst, current_attach, fp);
211 } 211 }
212 fclose(fp); 212 fclose(fp);
213 } 213 }
557 removeCR(item->body.str); 557 removeCR(item->body.str);
558 print_pdf(item->body.str); 558 print_pdf(item->body.str);
559 } else if (item->email->htmlbody.str) { 559 } else if (item->email->htmlbody.str) {
560 removeCR(item->email->htmlbody.str); 560 removeCR(item->email->htmlbody.str);
561 print_pdf(item->email->htmlbody.str); 561 print_pdf(item->email->htmlbody.str);
562 } else if (item->email->encrypted_body || item->email->encrypted_htmlbody) { 562 } else if (item->email->encrypted_body.data || item->email->encrypted_htmlbody.data) {
563 char ln[LINE_SIZE]; 563 char ln[LINE_SIZE];
564 snprintf(ln, sizeof(ln), "%s", "The body of this email is encrypted. This isn't supported yet, but the body is now an attachment\n"); 564 snprintf(ln, sizeof(ln), "%s", "The body of this email is encrypted. This isn't supported yet, but the body is now an attachment\n");
565 print_pdf(ln); 565 print_pdf(ln);
566 } 566 }
567 fprintf(dii_file, "@EMAIL-END\n"); 567 fprintf(dii_file, "@EMAIL-END\n");
568 568
569 int attach_num = 0; 569 int attach_num = 0;
570 for (pst_item_attach* current_attach = item->attach; current_attach; current_attach = current_attach->next) { 570 for (pst_item_attach* current_attach = item->attach; current_attach; current_attach = current_attach->next) {
571 DEBUG_EMAIL(("Attempting Attachment encoding\n")); 571 DEBUG_EMAIL(("Attempting Attachment encoding\n"));
572 if (!current_attach->data) { 572 if (!current_attach->data.data) {
573 DEBUG_EMAIL(("Data of attachment is NULL!. Size is supposed to be %i\n", current_attach->size)); 573 DEBUG_EMAIL(("Data of attachment is NULL!. Size is supposed to be %i\n", current_attach->data.size));
574 } 574 }
575 string an = write_separate_attachment(f.name, current_attach, ++attach_num, pst); 575 string an = write_separate_attachment(f.name, current_attach, ++attach_num, pst);
576 fprintf(dii_file, "@EATTACH %s\n", an.c_str()); 576 fprintf(dii_file, "@EATTACH %s\n", an.c_str());
577 } 577 }
578 close_pdf(); 578 close_pdf();
586 static void create_enter_dir(file_ll &f, file_ll *parent, pst_item *item) 586 static void create_enter_dir(file_ll &f, file_ll *parent, pst_item *item)
587 { 587 {
588 f.email_count = 0; 588 f.email_count = 0;
589 f.skip_count = 0; 589 f.skip_count = 0;
590 f.type = item->type; 590 f.type = item->type;
591 f.stored_count = (item->folder) ? item->folder->email_count : 0; 591 f.stored_count = (item->folder) ? item->folder->item_count : 0;
592 f.name = ((parent) ? parent->name + "/" : "") + string(item->file_as.str); 592 f.name = ((parent) ? parent->name + "/" : "") + string(item->file_as.str);
593 } 593 }
594 594
595 595
596 static void close_enter_dir(file_ll &f); 596 static void close_enter_dir(file_ll &f);