comparison src/readpst.c @ 79:56fa05fd5271

Patch from Robert Simpson for encryption type 2. Fix the order of testing item types to avoid claiming there are multiple message stores.
author Carl Byington <carl@five-ten-sg.com>
date Fri, 13 Jun 2008 20:47:01 -0700
parents 87216aefc6df
children 1e4a7610d525
comparison
equal deleted inserted replaced
78:535075b4d261 79:56fa05fd5271
131 if (item && item->email && item->email->subject && item->email->subject->subj) { 131 if (item && item->email && item->email->subject && item->email->subject->subj) {
132 DEBUG_EMAIL(("item->email->subject = %p\n", item->email->subject)); 132 DEBUG_EMAIL(("item->email->subject = %p\n", item->email->subject));
133 DEBUG_EMAIL(("item->email->subject->subj = %p\n", item->email->subject->subj)); 133 DEBUG_EMAIL(("item->email->subject->subj = %p\n", item->email->subject->subj));
134 } 134 }
135 if (item) { 135 if (item) {
136 if (item->message_store) {
137 // there should only be one message_store, and we have already done it
138 DIE(("main: A second message_store has been found. Sorry, this must be an error.\n"));
139 }
140
141 if (item->folder && d_ptr->child && strcasecmp(item->file_as, "Deleted Items")) { 136 if (item->folder && d_ptr->child && strcasecmp(item->file_as, "Deleted Items")) {
142 //if this is a non-empty folder other than deleted items, we want to recurse into it 137 //if this is a non-empty folder other than deleted items, we want to recurse into it
143 if (output_mode != OUTPUT_QUIET) printf("Processing Folder \"%s\"\n", item->file_as); 138 if (output_mode != OUTPUT_QUIET) printf("Processing Folder \"%s\"\n", item->file_as);
144 process(item, d_ptr->child); 139 process(item, d_ptr->child);
145 140
192 if (ff.type != PST_TYPE_APPOINTMENT) { 187 if (ff.type != PST_TYPE_APPOINTMENT) {
193 DEBUG_MAIN(("main: I have an appointment, but folder isn't specified as an appointment type. Processing...\n")); 188 DEBUG_MAIN(("main: I have an appointment, but folder isn't specified as an appointment type. Processing...\n"));
194 } 189 }
195 write_appointment(ff.output, item->appointment, item->email, item->create_date, item->modify_date); 190 write_appointment(ff.output, item->appointment, item->email, item->create_date, item->modify_date);
196 191
192 } else if (item->message_store) {
193 // there should only be one message_store, and we have already done it
194 DEBUG_MAIN(("item with message store content, type %i %s folder type %i, skipping it\n", item->type, item->ascii_type, ff.type));
195
197 } else { 196 } else {
198 // these all seem to be things that MS agrees are not included in the item count 197 // these all seem to be things that MS agrees are not included in the item count
199 //ff.skip_count++; 198 //ff.skip_count++;
200 DEBUG_MAIN(("main: Unknown item type %i (%s) name (%s)\n", 199 DEBUG_MAIN(("main: Unknown item type %i (%s) name (%s)\n",
201 item->type, item->ascii_type, item->file_as)); 200 item->type, item->ascii_type, item->file_as));
306 DEBUG_RET(); 305 DEBUG_RET();
307 return 1; 306 return 1;
308 } 307 }
309 308
310 while (0 != (l = fread(buf, 1, 1024, fp))) { 309 while (0 != (l = fread(buf, 1, 1024, fp))) {
311 if (0 != pst_decrypt(buf, l, PST_COMP_ENCRYPT)) 310 if (0 != pst_decrypt(0, buf, l, PST_COMP_ENCRYPT))
312 fprintf(stderr, "pst_decrypt() failed (I'll try to continue)\n"); 311 fprintf(stderr, "pst_decrypt() failed (I'll try to continue)\n");
313 312
314 if (l != pst_fwrite(buf, 1, l, stdout)) { 313 if (l != pst_fwrite(buf, 1, l, stdout)) {
315 fprintf(stderr, "Couldn't output to stdout?\n"); 314 fprintf(stderr, "Couldn't output to stdout?\n");
316 DEBUG_RET(); 315 DEBUG_RET();
411 int usage() { 410 int usage() {
412 DEBUG_ENT("usage"); 411 DEBUG_ENT("usage");
413 version(); 412 version();
414 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name); 413 printf("Usage: %s [OPTIONS] {PST FILENAME}\n", prog_name);
415 printf("OPTIONS:\n"); 414 printf("OPTIONS:\n");
416 printf("\t-C\t- Decrypt the entire file and output on stdout (not typically useful)\n"); 415 printf("\t-C\t- Decrypt (compressible encryption) the entire file and output on stdout (not typically useful)\n");
417 printf("\t-M\t- MH. Write emails in the MH format\n"); 416 printf("\t-M\t- MH. Write emails in the MH format\n");
418 printf("\t-S\t- Separate. Write emails in the separate format\n"); 417 printf("\t-S\t- Separate. Write emails in the separate format\n");
419 printf("\t-V\t- Version. Display program version\n"); 418 printf("\t-V\t- Version. Display program version\n");
420 printf("\t-b\t- Don't save RTF-Body attachments\n"); 419 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"); 420 printf("\t-c[v|l]\t- Set the Contact output mode. -cv = VCard, -cl = EMail list\n");