diff -r f8dfc5705516 -r 26acbfa75c1f application/davcontroller.c --- a/application/davcontroller.c Tue Jan 30 08:49:35 2024 +0100 +++ b/application/davcontroller.c Tue Jan 30 09:10:05 2024 +0100 @@ -78,6 +78,7 @@ // ------------------------------ davbrowser_query_path ------------------------------ typedef struct DavBrowserQueryPath { + UiThreadpool *pool; DavBrowser *browser; char *path; DavResource *result; @@ -97,16 +98,23 @@ DavBrowserQueryPath *query = data; DavBrowser *browser = event->document; - if (query->result) { - davbrowser_set_collection(event->obj, browser, query->result); + if (query->pool == browser->dav_queue) { + if (query->result) { + davbrowser_set_collection(event->obj, browser, query->result); + } else { + // TODO: error + } + + window_progress(event->window, 0); } else { - // TODO: error + // operation aborted + if (query->result) { + dav_resource_free_all(query->result); + } } free(query->path); free(query); - - window_progress(event->window, 0); } void davbrowser_query_path(UiObject *ui, DavBrowser *browser, const char *path) { @@ -125,6 +133,7 @@ free(full_path); DavBrowserQueryPath *query = malloc(sizeof(DavBrowserQueryPath)); + query->pool = browser->dav_queue; query->browser = browser; query->path = strdup(path); query->result = NULL; @@ -132,3 +141,18 @@ window_progress(ui->window, 1); } + +void davbrowser_query_url(UiObject *ui, DavBrowser *browser, const char *url) { + if (browser->repo_base) { + cxstring base = cx_str(browser->repo_base); + cxstring newurl = cx_str(url); + + if (cx_strprefix(newurl, base)) { + const char *path = url + base.length; + davbrowser_query_path(ui, browser, path); + return; + } + } + + // TODO: +}