comparison src/readpst.c @ 63:cfd6175f9334

Start work on pst2dii to convert to Summation dii load file format.
author Carl Byington <carl@five-ten-sg.com>
date Sat, 23 Feb 2008 14:36:17 -0800
parents 7d5c637aaafb
children b12f4e50e2e8
comparison
equal deleted inserted replaced
62:ee4e0d00bc94 63:cfd6175f9334
4 * Written by David Smith 4 * Written by David Smith
5 * dave.s@earthcorp.com 5 * dave.s@earthcorp.com
6 */ 6 */
7 #include "define.h" 7 #include "define.h"
8 #include "libstrfunc.h" 8 #include "libstrfunc.h"
9 #include "vbuf.h" 9 //#include "vbuf.h"
10 #include "libpst.h" 10 #include "libpst.h"
11 #include "common.h" 11 #include "common.h"
12 #include "timeconv.h" 12 #include "timeconv.h"
13 #include "lzfu.h" 13 #include "lzfu.h"
14 14
196 DEBUG_MAIN(("main: I have an appointment, but folder isn't specified as an appointment type. Processing...\n")); 196 DEBUG_MAIN(("main: I have an appointment, but folder isn't specified as an appointment type. Processing...\n"));
197 } 197 }
198 write_appointment(ff.output, item->appointment, item->email, item->create_date, item->modify_date); 198 write_appointment(ff.output, item->appointment, item->email, item->create_date, item->modify_date);
199 199
200 } else { 200 } else {
201 ff.skip_count++; 201 // these all seem to be things that MS agrees are not included in the item count
202 DEBUG_MAIN(("main: Unknown item type. %i. Ascii1=\"%s\"\n", 202 //ff.skip_count++;
203 item->type, item->ascii_type)); 203 DEBUG_MAIN(("main: Unknown item type %i (%s) name (%s)\n",
204 item->type, item->ascii_type, item->file_as));
204 } 205 }
205 pst_freeItem(item); 206 pst_freeItem(item);
206 } else { 207 } else {
207 ff.skip_count++; 208 ff.skip_count++;
208 DEBUG_MAIN(("main: A NULL item was seen\n")); 209 DEBUG_MAIN(("main: A NULL item was seen\n"));
365 if (!d_ptr) { 366 if (!d_ptr) {
366 DEBUG_RET(); 367 DEBUG_RET();
367 DIE(("Top of folders record not found. Cannot continue\n")); 368 DIE(("Top of folders record not found. Cannot continue\n"));
368 } 369 }
369 370
370 process(item, d_ptr->child); // do the children of TOPF 371 process(item, d_ptr->child); // do the children of TOPF
371 pst_freeItem(item); 372 pst_freeItem(item);
372 pst_close(&pstfile); 373 pst_close(&pstfile);
373
374 DEBUG_RET(); 374 DEBUG_RET();
375 return 0; 375 return 0;
376 } 376 }
377 377
378 378
415 int usage() { 415 int usage() {
416 DEBUG_ENT("usage"); 416 DEBUG_ENT("usage");
417 version(); 417 version();
418 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name); 418 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name);
419 printf("OPTIONS:\n"); 419 printf("OPTIONS:\n");
420 printf("\t-C\t- Decrypt the entire file and output on stdout (not typically useful)\n");
421 printf("\t-M\t- MH. Write emails in the MH format\n");
422 printf("\t-S\t- Seperate. Write emails in the seperate format\n");
423 printf("\t-V\t- Version. Display program version\n");
420 printf("\t-b\t- Don't save RTF-Body attachments\n"); 424 printf("\t-b\t- Don't save RTF-Body attachments\n");
421 printf("\t-c[v|l]\t- Set the Contact output mode. -cv = VCard, -cl = EMail list\n"); 425 printf("\t-c[v|l]\t- Set the Contact output mode. -cv = VCard, -cl = EMail list\n");
422 printf("\t-d <filename> \t- Debug to file. This is a binary log. Use readlog to print it\n"); 426 printf("\t-d <filename> \t- Debug to file. This is a binary log. Use readpstlog to print it\n");
423 printf("\t-h\t- Help. This screen\n"); 427 printf("\t-h\t- Help. This screen\n");
424 printf("\t-k\t- KMail. Output in kmail format\n"); 428 printf("\t-k\t- KMail. Output in kmail format\n");
425 printf("\t-M\t- MH. Write emails in the MH format\n"); 429 printf("\t-o <dirname>\t- Output directory to write files to. CWD is changed *after* opening pst file\n");
426 printf("\t-o <dirname>\t- Output Dir. Directory to write files to. CWD is changed *after* opening pst file\n");
427 printf("\t-q\t- Quiet. Only print error messages\n"); 430 printf("\t-q\t- Quiet. Only print error messages\n");
428 printf("\t-r\t- Recursive. Output in a recursive format\n"); 431 printf("\t-r\t- Recursive. Output in a recursive format\n");
429 printf("\t-S\t- Seperate. Write emails in the seperate format\n");
430 printf("\t-V\t- Version. Display program version\n");
431 printf("\t-w\t- Overwrite any output mbox files\n"); 432 printf("\t-w\t- Overwrite any output mbox files\n");
432 printf("\t-C\t- Decrypt the entire file and output on stdout (not typically useful)\n");
433 DEBUG_RET(); 433 DEBUG_RET();
434 return 0; 434 return 0;
435 } 435 }
436 436
437 437
913 fprintf(f_output, "%s", soh); 913 fprintf(f_output, "%s", soh);
914 len = strlen(soh); 914 len = strlen(soh);
915 if (!len || (soh[len-1] != '\n')) fprintf(f_output, "\n"); 915 if (!len || (soh[len-1] != '\n')) fprintf(f_output, "\n");
916 916
917 } else { 917 } else {
918 //make up our own header! 918 //make up our own headers
919 if (mode != MODE_SEPERATE) { 919 if (mode != MODE_SEPERATE) {
920 // don't want this first line for this mode 920 // don't want this first line for this mode
921 if (item->email->outlook_sender_name) { 921 if (item->email->outlook_sender_name) {
922 temp = item->email->outlook_sender_name; 922 temp = item->email->outlook_sender_name;
923 } else { 923 } else {
940 if (item->email->cc_address) { 940 if (item->email->cc_address) {
941 fprintf(f_output, "Cc: %s\n", item->email->cc_address); 941 fprintf(f_output, "Cc: %s\n", item->email->cc_address);
942 } 942 }
943 943
944 if (item->email->sent_date) { 944 if (item->email->sent_date) {
945 c_time = (char*) xmalloc(C_TIME_SIZE); 945 char c_time[C_TIME_SIZE];
946 strftime(c_time, C_TIME_SIZE, "%a, %d %b %Y %H:%M:%S %z", gmtime(&em_time)); 946 strftime(c_time, C_TIME_SIZE, "%a, %d %b %Y %H:%M:%S %z", gmtime(&em_time));
947 fprintf(f_output, "Date: %s\n", c_time); 947 fprintf(f_output, "Date: %s\n", c_time);
948 free(c_time);
949 } 948 }
950 } 949 }
951 950
952 fprintf(f_output, "MIME-Version: 1.0\n"); 951 fprintf(f_output, "MIME-Version: 1.0\n");
953 if (boundary && boundary_created) { 952 if (boundary && boundary_created) {