435
432
if (RecipClass && *RecipClass == recipClass) {
436
433
switch (recipClass) {
438
ret = fwrite(OCPF_RECIPIENT_TO, strlen(OCPF_RECIPIENT_TO), 1, fp);
435
fwrite(OCPF_RECIPIENT_TO, strlen(OCPF_RECIPIENT_TO), 1, fp);
441
ret = fwrite(OCPF_RECIPIENT_CC, strlen(OCPF_RECIPIENT_CC), 1, fp);
438
fwrite(OCPF_RECIPIENT_CC, strlen(OCPF_RECIPIENT_CC), 1, fp);
444
ret = fwrite(OCPF_RECIPIENT_BCC, strlen(OCPF_RECIPIENT_BCC), 1, fp);
441
fwrite(OCPF_RECIPIENT_BCC, strlen(OCPF_RECIPIENT_BCC), 1, fp);
454
451
line = ocpf_write_property(ctx, &found, ulPropTag, (void *)value_data);
455
452
if (found == true) {
456
453
ocpf_write_propname(ctx, fp, ulPropTag);
457
len = fwrite(line, strlen(line), 1, fp);
454
fwrite(line, strlen(line), 1, fp);
458
455
talloc_free(line);
464
ret = fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
465
ret = fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
461
fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
462
fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
667
663
/* message type */
669
665
line = talloc_asprintf(ctx, "TYPE \"%s\"\n\n", ctx->type);
670
len = fwrite(line, strlen(line), 1, fp);
666
fwrite(line, strlen(line), 1, fp);
671
667
talloc_free(line);
675
671
if (ctx->folder) {
676
672
line = talloc_asprintf(ctx, "FOLDER D0x%.16"PRIx64"\n\n", ctx->folder);
677
len = fwrite(line, strlen(line), 1, fp);
673
fwrite(line, strlen(line), 1, fp);
678
674
talloc_free(line);
682
678
for (nguid = ctx->oleguid; nguid->next; nguid = nguid->next) {
683
679
line = talloc_asprintf(ctx, "OLEGUID %-25s \"%s\"\n", nguid->name, nguid->guid);
684
len = fwrite(line, strlen(line), 1, fp);
680
fwrite(line, strlen(line), 1, fp);
685
681
talloc_free(line);
687
len = fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
683
fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
690
686
if (ctx->recipients && ctx->recipients->cRows) {
691
len = fwrite(OCPF_RECIPIENT_BEGIN, strlen(OCPF_RECIPIENT_BEGIN), 1, fp);
687
fwrite(OCPF_RECIPIENT_BEGIN, strlen(OCPF_RECIPIENT_BEGIN), 1, fp);
692
688
ocpf_write_recipients(ctx, fp, MAPI_TO);
693
689
ocpf_write_recipients(ctx, fp, MAPI_CC);
694
690
ocpf_write_recipients(ctx, fp, MAPI_BCC);
696
len = fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
697
len = fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
692
fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
693
fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
700
696
/* known properties */
701
len = fwrite(OCPF_PROPERTY_BEGIN, strlen(OCPF_PROPERTY_BEGIN), 1, fp);
697
fwrite(OCPF_PROPERTY_BEGIN, strlen(OCPF_PROPERTY_BEGIN), 1, fp);
702
698
for (element = ctx->props; element->next; element = element->next) {
703
699
line = ocpf_write_property(ctx, &found, element->aulPropTag, element->value);
704
700
if (found == true) {
705
701
ocpf_write_propname(ctx, fp, element->aulPropTag);
706
len = fwrite(line, strlen(line), 1, fp);
702
fwrite(line, strlen(line), 1, fp);
707
703
talloc_free(line);
711
len = fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
712
len = fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
707
fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
708
fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
714
710
/* named properties */
715
len = fwrite(OCPF_NPROPERTY_BEGIN, strlen(OCPF_NPROPERTY_BEGIN), 1, fp);
711
fwrite(OCPF_NPROPERTY_BEGIN, strlen(OCPF_NPROPERTY_BEGIN), 1, fp);
716
712
for (nelement = ctx->nprops; nelement->next; nelement = nelement->next) {
717
713
line = ocpf_write_property(ctx, &found, nelement->propType, nelement->value);
718
714
if (found == true) {
731
727
if (definition) {
732
len = fwrite(definition, strlen(definition), 1, fp);
728
fwrite(definition, strlen(definition), 1, fp);
733
729
talloc_free(definition);
736
len = fwrite(line, strlen(line), 1, fp);
732
fwrite(line, strlen(line), 1, fp);
737
733
talloc_free(line);
741
len = fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
737
fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
743
739
return OCPF_SUCCESS;