libidav/methods.c

changeset 231
f3119e749549
parent 227
bf485439222a
child 236
6b4ce32d0c4e
equal deleted inserted replaced
230:fdcbde1d7d65 231:f3119e749549
375 n = prop_node->children; 375 n = prop_node->children;
376 while(n) { 376 while(n) {
377 if(n->type == XML_ELEMENT_NODE) { 377 if(n->type == XML_ELEMENT_NODE) {
378 properties = ucx_list_append(properties, n); 378 properties = ucx_list_append(properties, n);
379 if(xstreq(n->name, "resourcetype")) { 379 if(xstreq(n->name, "resourcetype")) {
380 xmlNode *rsnode = n->children; 380 if(parse_resource_type(n)) {
381 if(rsnode && rsnode->type == XML_ELEMENT_NODE) { 381 iscollection = TRUE;
382 // TODO: check content
383 iscollection = 1;
384 } 382 }
385 } else if(xstreq(n->ns->href, DAV_NS)) { 383 } else if(xstreq(n->ns->href, DAV_NS)) {
386 if(xstreq(n->name, "crypto-name")) { 384 if(xstreq(n->name, "crypto-name")) {
387 crypto_name = util_xml_get_text(n); 385 crypto_name = util_xml_get_text(n);
388 } else if(xstreq(n->name, "crypto-key")) { 386 } else if(xstreq(n->name, "crypto-key")) {
610 n = prop_node->children; 608 n = prop_node->children;
611 while(n) { 609 while(n) {
612 if(n->type == XML_ELEMENT_NODE) { 610 if(n->type == XML_ELEMENT_NODE) {
613 properties = ucx_list_append(properties, n); 611 properties = ucx_list_append(properties, n);
614 if(xstreq(n->name, "resourcetype")) { 612 if(xstreq(n->name, "resourcetype")) {
615 xmlNode *rsnode = n->children; 613 if(parse_resource_type(n)) {
616 if(rsnode && rsnode->type == XML_ELEMENT_NODE) { 614 iscollection = TRUE;
617 // TODO: this is a ugly lazy hack
618 //resource_add_property(res, "DAV:", (char*)n->name, "collection");
619 iscollection = 1;
620 } 615 }
621 } else if(xstreq(n->ns->href, DAV_NS)) { 616 } else if(xstreq(n->ns->href, DAV_NS)) {
622 if(xstreq(n->name, "crypto-name")) { 617 if(xstreq(n->name, "crypto-name")) {
623 crypto_name = util_xml_get_text(n); 618 crypto_name = util_xml_get_text(n);
624 } else if(xstreq(n->name, "crypto-key")) { 619 } else if(xstreq(n->name, "crypto-key")) {
700 char *end = NULL; 695 char *end = NULL;
701 res->contentlength = strtoull(cl, &end, 0); 696 res->contentlength = strtoull(cl, &end, 0);
702 } 697 }
703 res->creationdate = util_parse_creationdate(cd); 698 res->creationdate = util_parse_creationdate(cd);
704 res->lastmodified = util_parse_lastmodified(lm); 699 res->lastmodified = util_parse_lastmodified(lm);
700 }
701
702 int parse_resource_type(xmlNode *node) {
703 int collection = FALSE;
704 xmlNode *c = node->children;
705 while(c) {
706 if(c->type == XML_ELEMENT_NODE) {
707 if(xstreq(c->ns->href, "DAV:") && xstreq(c->name, "collection")) {
708 collection = TRUE;
709 break;
710 }
711 }
712 c = c->next;
713 }
714 return collection;
705 } 715 }
706 716
707 717
708 /* ----------------------------- PROPPATCH ----------------------------- */ 718 /* ----------------------------- PROPPATCH ----------------------------- */
709 719

mercurial