dav/main.c

changeset 297
3cbe57eeaed1
parent 271
7b1ca53f3897
child 298
755b8198b071
equal deleted inserted replaced
296:bb49953b1cf8 297:3cbe57eeaed1
348 curl_easy_setopt(sn->handle, CURLOPT_SSL_VERIFYHOST, 0); 348 curl_easy_setopt(sn->handle, CURLOPT_SSL_VERIFYHOST, 0);
349 } 349 }
350 return sn; 350 return sn;
351 } 351 }
352 352
353 #define LIST_QUERY_ORDER_BY_NAME "select `idav:crypto-name`,`idav:crypto-key`,D:lockdiscovery,apache:executable from %s with depth = %d where lastmodified > %t order by iscollection desc, name"
354 #define LIST_QUERY_ORDER_BY_DATE "select `idav:crypto-name`,`idav:crypto-key`,D:lockdiscovery,apache:executable from %s with depth = %d where lastmodified > %t order by iscollection desc, lastmodified desc"
355
353 int cmd_list(CmdArgs *a) { 356 int cmd_list(CmdArgs *a) {
354 if(a->argc != 1) { 357 if(a->argc != 1) {
355 fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few":"many"); 358 fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few":"many");
356 return -1; 359 return -1;
357 } 360 }
364 if(set_session_config(sn, a)) { 367 if(set_session_config(sn, a)) {
365 return -1; 368 return -1;
366 } 369 }
367 370
368 char *update = cmd_getoption(a, "update"); 371 char *update = cmd_getoption(a, "update");
372 char *date = cmd_getoption(a, "date");
369 time_t t = -1; 373 time_t t = -1;
370 if(update) { 374 if(update) {
371 t = util_parse_lastmodified(update); 375 t = util_parse_lastmodified(update);
372 } 376 }
373 377
375 int ret = -1; 379 int ret = -1;
376 DavResource *ls; 380 DavResource *ls;
377 while(ret != 0) { 381 while(ret != 0) {
378 ls = dav_query( 382 ls = dav_query(
379 sn, 383 sn,
380 "select `idav:crypto-name`,`idav:crypto-key`,D:lockdiscovery,apache:executable from %s with depth = %d where lastmodified > %t order by iscollection desc, name", 384 date ? LIST_QUERY_ORDER_BY_DATE : LIST_QUERY_ORDER_BY_NAME,
381 path, 385 path,
382 depth, 386 depth,
383 t); 387 t);
384 388
385 if(!ls) { 389 if(!ls) {

mercurial