[wip] Mostly debugging statements

This commit is contained in:
Adam Cooper 2022-02-26 18:51:01 -05:00
parent b331363d09
commit 062d973d8a
1 changed files with 14 additions and 1 deletions

View File

@ -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"))