# HG changeset patch # User Carl Byington # Date 1244497659 25200 # Node ID 4a659f3138b7a0353ac40119876b55e3d105f169 # Parent 8e17efed33c1d59e6f972a7216e3dab665ac4bed fix pst2dii for shared library changes diff -r 8e17efed33c1 -r 4a659f3138b7 regression/regression-tests.bash --- a/regression/regression-tests.bash Mon Jun 08 13:51:24 2009 -0700 +++ b/regression/regression-tests.bash Mon Jun 08 14:47:39 2009 -0700 @@ -20,10 +20,10 @@ { n="$1" fn="$2" + echo $fn rm -rf output$n mkdir output$n - $val ../src/pst2dii -f /usr/share/fonts/bitstream-vera/VeraMono.ttf -B "bates-" -o output$n -O mydii$n -d dumper $fn >$fn.dii.err 2>&1 - ../src/readpstlog -f I dumper >$fn.log + $val ../src/pst2dii -f /usr/share/fonts/bitstream-vera/VeraMono.ttf -B "bates-" -o output$n -O mydii$n -d $fn.log $fn >$fn.dii.err 2>&1 rm -f dumper } @@ -36,9 +36,7 @@ ba=$(basename "$fn" .pst) rm -rf output$n mkdir output$n - #$val ../src/pst2ldif -d dumper -b 'o=ams-cc.com, c=US' -c 'newPerson' -o $fn >$ba.ldif.err 2>&1 - $val ../src/pst2ldif -d dumper -b 'o=ams-cc.com, c=US' -c 'inetOrgPerson' $fn >$ba.ldif.err 2>&1 - ../src/readpstlog -f I dumper >$ba.ldif.log + $val ../src/pst2ldif -d $ba.ldif.log -b 'o=ams-cc.com, c=US' -c 'inetOrgPerson' $fn >$ba.ldif.err 2>&1 rm -f dumper } @@ -101,6 +99,7 @@ dopst 2 sample_64.pst dopst 3 test.pst dopst 4 big_mail.pst + exit dopst 5 mbmg.archive.pst dopst 6 Single2003-read.pst dopst 7 Single2003-unread.pst diff -r 8e17efed33c1 -r 4a659f3138b7 src/pst2dii.cpp.in --- a/src/pst2dii.cpp.in Mon Jun 08 13:51:24 2009 -0700 +++ b/src/pst2dii.cpp.in Mon Jun 08 14:47:39 2009 -0700 @@ -202,7 +202,7 @@ } DEBUG_INFO(("Saving attachment to %s\n", temp)); if (!(fp = fopen(temp, "wb"))) { - WARN(("write_separate_attachment: Cannot open attachment save file \"%s\"\n", temp)); + DEBUG_WARN(("write_separate_attachment: Cannot open attachment save file \"%s\"\n", temp)); } else { (void)pst_attach_to_file(pst, current_attach, fp); fclose(fp); @@ -563,13 +563,15 @@ fprintf(dii_file, "@EMAIL-END\n"); int attach_num = 0; - for (pst_item_attach* current_attach = item->attach; current_attach; current_attach = current_attach->next) { + for (pst_item_attach* attach = item->attach; attach; attach = attach->next) { + pst_convert_utf8_null(item, &attach->filename1); + pst_convert_utf8_null(item, &attach->filename2); + pst_convert_utf8_null(item, &attach->mimetype); DEBUG_INFO(("Attempting Attachment encoding\n")); - if (!current_attach->data.data) { - DEBUG_WARN(("Data of attachment is NULL!. Size is supposed to be %i\n", current_attach->data.size)); + if (attach->data.data || attach->i_id) { + string an = write_separate_attachment(f.name, attach, ++attach_num, pst); + fprintf(dii_file, "@EATTACH %s\n", an.c_str()); } - string an = write_separate_attachment(f.name, current_attach, ++attach_num, pst); - fprintf(dii_file, "@EATTACH %s\n", an.c_str()); } close_pdf(); fprintf(dii_file, "@BATESBEG %d\n", bates); @@ -581,8 +583,7 @@ static void create_enter_dir(file_ll &f, file_ll *parent, pst_item *item); static void create_enter_dir(file_ll &f, file_ll *parent, pst_item *item) { - f.email_count = 0; - f.skip_count = 0; + pst_convert_utf8(item, &item->file_as); f.type = item->type; f.stored_count = (item->folder) ? item->folder->item_count : 0; f.name = ((parent) ? parent->name + "/" : "") + string(item->file_as.str); @@ -602,30 +603,28 @@ pst_item *item = NULL; DEBUG_ENT("process"); create_enter_dir(ff, parent, outeritem); - while (d_ptr) { + for (; d_ptr; d_ptr = d_ptr->next) { if (d_ptr->desc) { item = pst_parse_item(&pstfile, d_ptr, NULL); DEBUG_INFO(("item pointer is %p\n", item)); if (item) { - if (item->folder && d_ptr->child ) { + if (item->folder && item->file_as.str && d_ptr->child ) { //if this is a non-empty folder, we want to recurse into it fprintf(stderr, "entering folder %s\n", item->file_as.str); process(item, &ff, d_ptr->child); - } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT || item->type == PST_TYPE_OTHER)) { + } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_SCHEDULE || item->type == PST_TYPE_REPORT)) { ff.email_count++; - DEBUG_INFO(("Processing Email\n")); - if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_REPORT) && (ff.type != PST_TYPE_OTHER)) { - DEBUG_INFO(("I have an email, but the folder isn't an email folder. Processing anyway\n")); - } write_normal_email(ff, item, &pstfile); } + else { + ff.skip_count++; // other mapi objects + } pst_freeItem(item); } else { ff.skip_count++; DEBUG_INFO(("A NULL item was seen\n")); } } - d_ptr = d_ptr->next; } close_enter_dir(ff); DEBUG_RET(); diff -r 8e17efed33c1 -r 4a659f3138b7 src/readpst.c --- a/src/readpst.c Mon Jun 08 13:51:24 2009 -0700 +++ b/src/readpst.c Mon Jun 08 14:47:39 2009 -0700 @@ -1808,8 +1808,6 @@ void create_enter_dir(struct file_ll* f, pst_item *item) { pst_convert_utf8(item, &item->file_as); - f->item_count = 0; - f->skip_count = 0; f->type = item->type; f->stored_count = (item->folder) ? item->folder->item_count : 0;