dav/finfo.c

changeset 607
5dc7fe41e8f8
parent 539
8deb52292c99
child 614
e72d2b99b0f6
equal deleted inserted replaced
606:aa49966e4e85 607:5dc7fe41e8f8
99 99
100 if((finfo & FINFO_DATE) == FINFO_DATE) { 100 if((finfo & FINFO_DATE) == FINFO_DATE) {
101 char str[32]; 101 char str[32];
102 struct tm *date = gmtime(&s->st_mtime); 102 struct tm *date = gmtime(&s->st_mtime);
103 strftime(str, 32, "%a, %d %b %Y %H:%M:%S GMT", date); 103 strftime(str, 32, "%a, %d %b %Y %H:%M:%S GMT", date);
104 DavXmlNode *mtime = dav_xml_createnode_with_text(DAV_NS, "mtime", str); 104 DavXmlNode *mtime = dav_xml_createnode_with_text(DAV_PROPS_NS, "mtime", str);
105 content = mtime; 105 content = mtime;
106 last = mtime; 106 last = mtime;
107 } 107 }
108 #ifndef _WIN32 108 #ifndef _WIN32
109 if((finfo & FINFO_OWNER) == FINFO_OWNER) { 109 if((finfo & FINFO_OWNER) == FINFO_OWNER) {
111 } 111 }
112 if((finfo & FINFO_MODE) == FINFO_MODE) { 112 if((finfo & FINFO_MODE) == FINFO_MODE) {
113 mode_t mode = s->st_mode & 07777; 113 mode_t mode = s->st_mode & 07777;
114 char str[32]; 114 char str[32];
115 snprintf(str, 32, "%o", (int)mode); 115 snprintf(str, 32, "%o", (int)mode);
116 DavXmlNode *xmode = dav_xml_createnode_with_text(DAV_NS, "mode", str); 116 DavXmlNode *xmode = dav_xml_createnode_with_text(DAV_PROPS_NS, "mode", str);
117 if(last) { 117 if(last) {
118 last->next = xmode; 118 last->next = xmode;
119 } else { 119 } else {
120 content = xmode; 120 content = xmode;
121 } 121 }
122 last = xmode; 122 last = xmode;
123 } 123 }
124 #endif 124 #endif
125 125
126 126
127 dav_set_property(res, "idav:finfo", content);; 127 dav_set_property_ns(res, DAV_PROPS_NS, "finfo", content);;
128 128
129 return 0; 129 return 0;
130 } 130 }
131 131
132 XAttributes* xml_get_attributes(DavXmlNode *xml) { 132 XAttributes* xml_get_attributes(DavXmlNode *xml) {
243 int resource_set_xattr(DavResource *res, XAttributes *xattr) { 243 int resource_set_xattr(DavResource *res, XAttributes *xattr) {
244 if(!xattr || xattr->nattr == 0) { 244 if(!xattr || xattr->nattr == 0) {
245 return 0; 245 return 0;
246 } 246 }
247 247
248 DavXmlNode *content = dav_xml_createnode_with_text(DAV_NS, "hash", xattr->hash); 248 DavXmlNode *content = dav_xml_createnode_with_text(DAV_PROPS_NS, "hash", xattr->hash);
249 DavXmlNode *last = content; 249 DavXmlNode *last = content;
250 250
251 for(int i=0;i<xattr->nattr;i++) { 251 for(int i=0;i<xattr->nattr;i++) {
252 DavXmlNode *attr = dav_xml_createnode(DAV_NS, "xattr"); 252 DavXmlNode *attr = dav_xml_createnode(DAV_PROPS_NS, "xattr");
253 dav_xml_add_attr(attr, "name", xattr->names[i]); 253 dav_xml_add_attr(attr, "name", xattr->names[i]);
254 last->next = attr; 254 last->next = attr;
255 last = attr; 255 last = attr;
256 256
257 sstr_t value = xattr->values[i]; 257 sstr_t value = xattr->values[i];
260 attr->children = dav_xml_createtextnode(encval); 260 attr->children = dav_xml_createtextnode(encval);
261 free(encval); 261 free(encval);
262 } 262 }
263 } 263 }
264 264
265 dav_set_property(res, "idav:xattributes", content); 265 dav_set_property_ns(res, DAV_PROPS_NS, "xattributes", content);
266 266
267 return 0; 267 return 0;
268 } 268 }
269 269
270 void xattributes_free(XAttributes *xattr) { 270 void xattributes_free(XAttributes *xattr) {

mercurial