comparison pst2ldif.cpp @ 12:3f627519a92d stable-0-5-2

properly ignore (second block zero) errors. that will just drop some unknown attachments, but the rest of the data is still found
author carl
date Sat, 18 Feb 2006 09:56:00 -0800
parents bf12a9d4524c
children 80ae7e5cb562
comparison
equal deleted inserted replaced
11:bf12a9d4524c 12:3f627519a92d
134 static void process(pst_desc_ll *d_ptr) { 134 static void process(pst_desc_ll *d_ptr) {
135 pst_item *item = NULL; 135 pst_item *item = NULL;
136 while (d_ptr) { 136 while (d_ptr) {
137 if (d_ptr->desc) { 137 if (d_ptr->desc) {
138 item = (pst_item*)_pst_parse_item(&pstfile, d_ptr); 138 item = (pst_item*)_pst_parse_item(&pstfile, d_ptr);
139 DEBUG_INFO(("item pointer is %p\n", item));
139 if (item) { 140 if (item) {
140 if (item->message_store) { 141 if (item->message_store) {
141 // there should only be one message_store, and we have already done it 142 // there should only be one message_store, and we have already done it
142 DIE(("main: A second message_store has been found. Sorry, this must be an error.\n")); 143 DIE(("main: A second message_store has been found. Sorry, this must be an error.\n"));
143 } 144 }
344 345
345 printf("objectClass: %s\n\n", ldap_class); 346 printf("objectClass: %s\n\n", ldap_class);
346 } 347 }
347 } 348 }
348 } 349 }
350 else {
351 DEBUG_INFO(("item is not a contact\n"));
352 }
349 } 353 }
350 _pst_freeItem(item); 354 _pst_freeItem(item);
351 } 355 }
352 d_ptr = d_ptr->next; 356 d_ptr = d_ptr->next;
353 } 357 }
407 pst_load_extended_attributes(&pstfile); 411 pst_load_extended_attributes(&pstfile);
408 412
409 d_ptr = pstfile.d_head; // first record is main record 413 d_ptr = pstfile.d_head; // first record is main record
410 item = (pst_item*)_pst_parse_item(&pstfile, d_ptr); 414 item = (pst_item*)_pst_parse_item(&pstfile, d_ptr);
411 if (!item || !item->message_store) { 415 if (!item || !item->message_store) {
416 DEBUG_RET();
412 DIE(("main: Could not get root record\n")); 417 DIE(("main: Could not get root record\n"));
413 } 418 }
414 419
415 d_ptr = pst_getTopOfFolders(&pstfile, item); 420 d_ptr = pst_getTopOfFolders(&pstfile, item);
416 if (!d_ptr) { 421 if (!d_ptr) {
422 DEBUG_RET();
417 DIE(("Top of folders record not found. Cannot continue\n")); 423 DIE(("Top of folders record not found. Cannot continue\n"));
418 } 424 }
419 425
420 _pst_freeItem(item); 426 _pst_freeItem(item);
421 427
427 printf("cn: root\n"); 433 printf("cn: root\n");
428 printf("objectClass: %s\n\n", ldap_class); 434 printf("objectClass: %s\n\n", ldap_class);
429 435
430 process(d_ptr->child); // do the children of TOPF 436 process(d_ptr->child); // do the children of TOPF
431 pst_close(&pstfile); 437 pst_close(&pstfile);
438 DEBUG_RET();
432 return 0; 439 return 0;
433 } 440 }
434 441
435 442
436 int usage() { 443 int usage() {