895 } |
895 } |
896 |
896 |
897 return result; |
897 return result; |
898 } |
898 } |
899 |
899 |
|
900 |
|
901 static PgPropertyStoreExt* pg_proppatch_prop_get_ext(PgWebdavBackend *pgdav, WebdavProperty *property) { |
|
902 UcxKey pkey = webdav_property_key((const char*)property->namespace->href, property->name); |
|
903 PgPropertyStoreExt *ext = ucx_map_get(pgdav->repository->prop_ext, pkey); |
|
904 free((void*)pkey.data); |
|
905 return ext; |
|
906 } |
|
907 |
900 #define PG_PROPPATCH_EXT_SET 0 |
908 #define PG_PROPPATCH_EXT_SET 0 |
901 #define PG_PROPPATCH_EXT_REMOVE 1 |
909 #define PG_PROPPATCH_EXT_REMOVE 1 |
902 |
910 |
903 static int pg_proppatch_add_ext_prop( |
911 static int pg_proppatch_add_ext_prop( |
904 pool_handle_t *pool, |
912 pool_handle_t *pool, |
905 PgWebdavBackend *pgdav, |
913 PgWebdavBackend *pgdav, |
906 PgProppatch *proppatch, |
914 PgProppatch *proppatch, |
907 WebdavProperty *property, |
915 WebdavProperty *property, |
|
916 PgPropertyStoreExt *ext, |
908 int proppatch_op) |
917 int proppatch_op) |
909 { |
918 { |
910 UcxKey pkey = webdav_property_key((const char*)property->namespace->href, property->name); |
919 PgProppatchExtProp *ext_prop = pool_malloc(pool, sizeof(PgProppatchExtProp)); |
911 PgPropertyStoreExt *ext = ucx_map_get(pgdav->repository->prop_ext, pkey); |
920 if(!ext_prop) { |
912 free((void*)pkey.data); |
921 return 1; |
913 if(ext) { |
922 } |
914 PgProppatchExtProp *ext_prop = pool_malloc(pool, sizeof(PgProppatchExtProp)); |
923 ext_prop->column = ext; |
915 if(!ext_prop) { |
924 ext_prop->property = property; |
916 return 1; |
925 |
917 } |
926 UcxAllocator a = util_pool_allocator(pool); |
918 ext_prop->column = ext; |
927 proppatch->ext[ext->tableindex].isused = TRUE; |
919 ext_prop->property = property; |
928 |
920 |
929 UcxList **list = proppatch_op == PG_PROPPATCH_EXT_REMOVE |
921 UcxAllocator a = util_pool_allocator(pool); |
930 ? &proppatch->ext[ext->tableindex].remove |
922 proppatch->ext[ext->tableindex].isused = TRUE; |
931 : &proppatch->ext[ext->tableindex].set; |
923 |
932 *list = ucx_list_append_a(&a, *list, ext_prop); |
924 UcxList **list = proppatch_op == PG_PROPPATCH_EXT_REMOVE |
933 |
925 ? &proppatch->ext[ext->tableindex].remove |
934 proppatch->extensions_used = TRUE; |
926 : &proppatch->ext[ext->tableindex].set; |
|
927 *list = ucx_list_append_a(&a, *list, ext_prop); |
|
928 |
|
929 proppatch->extensions_used = TRUE; |
|
930 } |
|
931 |
935 |
932 return 0; |
936 return 0; |
933 } |
937 } |
934 |
938 |
935 static int pg_dav_set_property( |
939 static int pg_dav_set_property( |
943 PgProppatch *proppatch = request->userdata; |
947 PgProppatch *proppatch = request->userdata; |
944 WSNamespace *ns = property->namespace; |
948 WSNamespace *ns = property->namespace; |
945 |
949 |
946 // check if the property belongs to an extension |
950 // check if the property belongs to an extension |
947 if(proppatch->ext && ns) { |
951 if(proppatch->ext && ns) { |
948 return pg_proppatch_add_ext_prop(pool, pgdav, proppatch, property, PG_PROPPATCH_EXT_SET); |
952 PgPropertyStoreExt *ext = pg_proppatch_prop_get_ext(pgdav, property); |
|
953 if(ext) { |
|
954 return pg_proppatch_add_ext_prop(pool, pgdav, proppatch, property, ext, PG_PROPPATCH_EXT_SET); |
|
955 } // else: property is not stored in an extension table, continue with normal property store |
949 } |
956 } |
950 |
957 |
951 char *resource_id_str = userdata; |
958 char *resource_id_str = userdata; |
952 int ret = 0; |
959 int ret = 0; |
953 |
960 |
1004 PgProppatch *proppatch = request->userdata; |
1011 PgProppatch *proppatch = request->userdata; |
1005 WSNamespace *ns = property->namespace; |
1012 WSNamespace *ns = property->namespace; |
1006 |
1013 |
1007 // check if the property belongs to an extension |
1014 // check if the property belongs to an extension |
1008 if(proppatch->ext && ns) { |
1015 if(proppatch->ext && ns) { |
1009 return pg_proppatch_add_ext_prop(pool, pgdav, proppatch, property, PG_PROPPATCH_EXT_REMOVE); |
1016 PgPropertyStoreExt *ext = pg_proppatch_prop_get_ext(pgdav, property); |
|
1017 if(ext) { |
|
1018 return pg_proppatch_add_ext_prop(pool, pgdav, proppatch, property, ext, PG_PROPPATCH_EXT_REMOVE); |
|
1019 } // else: property is not stored in an extension table, continue with normal property store |
1010 } |
1020 } |
1011 |
1021 |
1012 char *resource_id_str = userdata; |
1022 char *resource_id_str = userdata; |
1013 int ret = 0; |
1023 int ret = 0; |
1014 |
1024 |