627 p->vtype = WS_VALUE_XML_NODE; |
628 p->vtype = WS_VALUE_XML_NODE; |
628 return 0; |
629 return 0; |
629 } |
630 } |
630 |
631 |
631 WebdavVFSProperties webdav_vfs_properties( |
632 WebdavVFSProperties webdav_vfs_properties( |
632 WebdavPropfindRequest *rq, |
633 WebdavPList **plistInOut, |
633 WSBool removefromlist, |
634 WSBool removefromlist, |
634 uint32_t flags) |
635 uint32_t flags) |
635 { |
636 { |
636 WebdavVFSProperties ret; |
637 WebdavVFSProperties ret; |
637 ZERO(&ret, sizeof(WebdavVFSProperties)); |
638 ZERO(&ret, sizeof(WebdavVFSProperties)); |
638 |
639 |
639 WSBool etag = 1; |
640 WSBool etag = 1; |
640 WSBool creationdate = 1; |
641 WSBool creationdate = 1; |
641 |
642 |
642 WebdavPList *property = rq->properties; |
643 WebdavPListIterator i = webdav_plist_iterator(plistInOut); |
643 WebdavPList *prev = NULL; |
644 WebdavPList *cur; |
644 while(property) { |
645 while(webdav_plist_iterator_next(&i, &cur)) { |
645 WebdavPList *next = property->next; |
646 WSNamespace *ns = cur->property->namespace; |
646 WSNamespace *ns = property->property->namespace; |
647 if(ns && !strcmp((const char*)ns->href, "DAV:")) { |
647 if(ns && !strcmp((char*)ns->href, "DAV:")) { |
648 const char *name = cur->property->name; |
648 const char *name = property->property->name; |
649 WSBool remove_prop = TRUE; |
649 WebdavPList *removethis = property; |
|
650 if(!strcmp(name, "getlastmodified")) { |
650 if(!strcmp(name, "getlastmodified")) { |
651 ret.getlastmodified = 1; |
651 ret.getlastmodified = 1; |
652 } else if(!strcmp(name, "getcontentlength")) { |
652 } else if(!strcmp(name, "getcontentlength")) { |
653 ret.getcontentlength = 1; |
653 ret.getcontentlength = 1; |
654 } else if(!strcmp(name, "resourcetype")) { |
654 } else if(!strcmp(name, "resourcetype")) { |
656 } else if(etag && !strcmp(name, "getetag")) { |
656 } else if(etag && !strcmp(name, "getetag")) { |
657 ret.getetag = 1; |
657 ret.getetag = 1; |
658 } else if(creationdate && !strcmp(name, "creationdate")) { |
658 } else if(creationdate && !strcmp(name, "creationdate")) { |
659 ret.creationdate = 1; |
659 ret.creationdate = 1; |
660 } else { |
660 } else { |
661 removethis = NULL; |
661 remove_prop = FALSE; |
662 } |
662 } |
663 |
663 |
664 if(removefromlist && removethis) { |
664 if(remove_prop) { |
665 |
665 webdav_plist_iterator_remove_current(&i); |
666 if(prev) { |
|
667 prev->next = next; |
|
668 } else { |
|
669 rq->properties = next; |
|
670 } |
|
671 } |
666 } |
672 } |
667 } |
673 prev = property; |
|
674 property = next; |
|
675 } |
668 } |
676 |
669 |
677 return ret; |
670 return ret; |
678 } |
671 } |
679 |
672 |