567 int ret = dav_propfind(res->session, res, rqbuf); |
567 int ret = dav_propfind(res->session, res, rqbuf); |
568 ucx_buffer_free(rqbuf); |
568 ucx_buffer_free(rqbuf); |
569 return ret; |
569 return ret; |
570 } |
570 } |
571 |
571 |
|
572 int dav_load_prop(DavResource *res, DavPropName *properties, size_t numprop) { |
|
573 UcxMempool *mp = ucx_mempool_new(64); |
|
574 |
|
575 UcxList *proplist = NULL; |
|
576 for(size_t i=0;i<numprop;i++) { |
|
577 DavProperty *p = ucx_mempool_malloc(mp, sizeof(DavProperty)); |
|
578 p->name = properties[i].name; |
|
579 p->ns = ucx_mempool_malloc(mp, sizeof(DavNamespace)); |
|
580 p->ns->name = properties[i].ns; |
|
581 if(!strcmp(properties[i].ns, "DAV:")) { |
|
582 p->ns->prefix = "D"; |
|
583 } else { |
|
584 p->ns->prefix = ucx_asprintf(mp->allocator, "x%d", i).ptr; |
|
585 } |
|
586 p->value = NULL; |
|
587 proplist = ucx_list_append_a(mp->allocator, proplist, p); |
|
588 } |
|
589 |
|
590 UcxBuffer *rqbuf = create_propfind_request(res->session, proplist); |
|
591 int ret = dav_propfind(res->session, res, rqbuf); |
|
592 ucx_buffer_free(rqbuf); |
|
593 ucx_mempool_destroy(mp); |
|
594 return ret; |
|
595 } |
|
596 |
572 int dav_store(DavResource *res) { |
597 int dav_store(DavResource *res) { |
573 DavSession *sn = res->session; |
598 DavSession *sn = res->session; |
574 DavResourceData *data = res->data; |
599 DavResourceData *data = res->data; |
575 |
600 |
576 util_set_url(sn, dav_resource_get_href(res)); |
601 util_set_url(sn, dav_resource_get_href(res)); |