~ubuntu-branches/debian/sid/openchange/sid

« back to all changes in this revision

Viewing changes to libocpf/ocpf_write.c

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-04-12 20:07:57 UTC
  • mfrom: (11 sid)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20120412200757-k933d9trljmxj1l4
Tags: 1:1.0-4
* openchangeserver: Add dependency on openchangeproxy.
* Rebuild against newer version of Samba 4.
* Use dpkg-buildflags.
* Migrate to Git, update Vcs-Git header.
* Switch to debhelper 9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
{
136
136
        const char      *propname;
137
137
        char            *line;
138
 
        ssize_t         len;
139
138
 
140
139
        propname = get_proptag_name(ulPropTag);
141
140
        if (propname) {
143
142
        } else {
144
143
                line = talloc_asprintf(ctx, "\t0x%x = ", ulPropTag);
145
144
        }
146
 
        len = fwrite(line, strlen(line), 1, fp);
 
145
        fwrite(line, strlen(line), 1, fp);
147
146
        talloc_free(line);
148
147
}
149
148
 
323
322
}
324
323
 
325
324
 
326
 
static char *ocpf_write_mv_unicode(struct ocpf_context *ctx, const struct WStringArray_r *value)
 
325
static char *ocpf_write_mv_unicode(struct ocpf_context *ctx, const struct StringArrayW_r *value)
327
326
{
328
327
        char            *str = NULL;
329
328
        char            *tmp = NULL;
398
397
                *found = true;
399
398
                break;
400
399
        case PT_MV_UNICODE:
401
 
                line = ocpf_write_mv_unicode(ctx, (const struct WStringArray_r *)value);
 
400
                line = ocpf_write_mv_unicode(ctx, (const struct StringArrayW_r *)value);
402
401
                *found = true;
403
402
                break;
404
403
        case PT_MV_BINARY:
415
414
                                 FILE *fp,
416
415
                                 enum ulRecipClass recipClass)
417
416
{
418
 
        int                     ret;
419
 
        ssize_t                 len;
420
417
        int                     i;
421
418
        int                     j;
422
419
        char                    *line = NULL;
435
432
                        if (RecipClass && *RecipClass == recipClass) {
436
433
                                switch (recipClass) {
437
434
                                case MAPI_TO:
438
 
                                        ret = fwrite(OCPF_RECIPIENT_TO, strlen(OCPF_RECIPIENT_TO), 1, fp);
 
435
                                        fwrite(OCPF_RECIPIENT_TO, strlen(OCPF_RECIPIENT_TO), 1, fp);
439
436
                                        break;
440
437
                                case MAPI_CC:
441
 
                                        ret = fwrite(OCPF_RECIPIENT_CC, strlen(OCPF_RECIPIENT_CC), 1, fp);
 
438
                                        fwrite(OCPF_RECIPIENT_CC, strlen(OCPF_RECIPIENT_CC), 1, fp);
442
439
                                        break;
443
440
                                case MAPI_BCC:
444
 
                                        ret = fwrite(OCPF_RECIPIENT_BCC, strlen(OCPF_RECIPIENT_BCC), 1, fp);
 
441
                                        fwrite(OCPF_RECIPIENT_BCC, strlen(OCPF_RECIPIENT_BCC), 1, fp);
445
442
                                        break;
446
443
                                default:
447
444
                                        break;
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);
459
456
                                                        found = false;
460
457
                                                }
461
458
                                        }
462
459
                                }
463
460
 
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);
466
463
                        }
467
464
                }
468
465
        }
646
643
        char                    *line;
647
644
        bool                    found = false;
648
645
        char                    *definition = NULL;
649
 
        ssize_t                 len;
650
646
 
651
647
        /* Find the context */
652
648
        ctx = ocpf_context_search_by_context_id(ocpf->context, context_id);
667
663
        /* message type */
668
664
        if (ctx->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);
672
668
        }
673
669
 
674
670
        /* folder id */
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);
679
675
        }
680
676
 
681
677
        /* OLEGUID */
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);
686
682
        }
687
 
        len = fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
 
683
        fwrite(OCPF_NEWLINE, strlen(OCPF_NEWLINE), 1, fp);
688
684
 
689
685
        /* RECIPIENT */
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);
695
691
 
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);
698
694
        }
699
695
 
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);
708
704
                        found = false;
709
705
                }
710
706
        }
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);
713
709
 
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) {
729
725
                        }
730
726
                        
731
727
                        if (definition) {
732
 
                                len = fwrite(definition, strlen(definition), 1, fp);
 
728
                                fwrite(definition, strlen(definition), 1, fp);
733
729
                                talloc_free(definition);
734
730
                        }
735
731
 
736
 
                        len = fwrite(line, strlen(line), 1, fp);
 
732
                        fwrite(line, strlen(line), 1, fp);
737
733
                        talloc_free(line);
738
734
                        found = false;
739
735
                }
740
736
        }
741
 
        len = fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
 
737
        fwrite(OCPF_END, strlen(OCPF_END), 1, fp);
742
738
 
743
739
        return OCPF_SUCCESS;
744
740
}