From 062d973d8a2f5e6994c61b9f242d14d211a4058b Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Sat, 26 Feb 2022 18:51:01 -0500 Subject: [PATCH] [wip] Mostly debugging statements --- src/main.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 4e18b6b..1dc141f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -138,9 +138,13 @@ async fn traverse(mut result: Multistatus) { // Depth first traversal while current_index < (&mut result.response).len() { + debug!("current_index: {:?}", current_index); // If result.response[current_index] has not been visited if !visited_items.contains_key(&mut result.response[current_index].propstat[0].prop.get_etag) { + debug!("Fresh item..."); + // if it's a collection if !(&mut result.response[current_index].propstat[0].prop.resource_type.collection).is_empty() { + debug!("Collection..."); // Get the contents XML let folder_contents: String = get_folder_contents( &result.response[current_index].href, // change to mutable borrow if necessary @@ -150,9 +154,16 @@ async fn traverse(mut result: Multistatus) { debug!("{:?}", folder_contents); // Parse the contents XML into Multistatus let mut new_result: Multistatus = from_str(&String::from(folder_contents)).unwrap(); + debug!("\nParsed:\n{:?}", new_result); // Append the NextcloudResponse vector to result.response result.response.append(&mut new_result.response); - } // else if it's not public, publicise it. + } else { + debug!("Node..."); + // else it's a node. if it's not public, publicise it. + if !(&mut result.response[current_index].propstat[0].prop.share_types).contains(&ShareType{ share_type: 3 }) { + println!("it's not public"); + } + } // also add debugging statements in this function throughout! } current_index += 1; @@ -187,6 +198,8 @@ async fn main() -> std::io::Result<()> { .init(); println!("Publicise it!"); + // TODO: Call get_password here. Maybe get_password should then store the password in the + // environment? let folder_contents: String = // get_folder_contents("/nextcloud/remote.php/dav/files/adam/test_public/2019_test_public") get_folder_contents(&String::from("/nextcloud/remote.php/dav/files/adam/test_public"))