diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-28 16:03:25 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-05-28 16:03:25 +0200 |
commit | 18f2154151b2cf81e03bdda28fa2ea5d685e33d1 (patch) | |
tree | a6fae34924e2808eb65276919d671718adbfbd44 /aero-dav/src/syncdecoder.rs | |
parent | 171a762768aabd799a1012d2fb939d869ff53f7b (diff) | |
download | aerogramme-18f2154151b2cf81e03bdda28fa2ea5d685e33d1.tar.gz aerogramme-18f2154151b2cf81e03bdda28fa2ea5d685e33d1.zip |
implement propfind sync-token
Diffstat (limited to 'aero-dav/src/syncdecoder.rs')
-rw-r--r-- | aero-dav/src/syncdecoder.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/aero-dav/src/syncdecoder.rs b/aero-dav/src/syncdecoder.rs index be25b79..2a61dea 100644 --- a/aero-dav/src/syncdecoder.rs +++ b/aero-dav/src/syncdecoder.rs @@ -7,10 +7,11 @@ use super::xml::{IRead, QRead, Reader, DAV_URN}; impl QRead<PropertyRequest> for PropertyRequest { async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> { - let mut dirty = false; - let mut m_cdr = None; - xml.maybe_read(&mut m_cdr, &mut dirty).await?; - m_cdr.ok_or(ParsingError::Recoverable).map(Self::SyncToken) + if xml.maybe_open(DAV_URN, "sync-token").await?.is_some() { + xml.close().await?; + return Ok(Self::SyncToken); + } + return Err(ParsingError::Recoverable); } } @@ -88,7 +89,6 @@ impl QRead<SyncTokenRequest> for SyncTokenRequest { impl QRead<SyncToken> for SyncToken { async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> { - println!("sync_token {:?}", xml.peek()); xml.open(DAV_URN, "sync-token").await?; let token = xml.tag_string().await?; xml.close().await?; @@ -213,9 +213,7 @@ mod tests { #[tokio::test] async fn prop_req() { let expected = dav::PropName::<All>(vec![dav::PropertyRequest::Extension( - realization::PropertyRequest::Sync(PropertyRequest::SyncToken( - SyncTokenRequest::InitialSync, - )), + realization::PropertyRequest::Sync(PropertyRequest::SyncToken), )]); let src = r#"<prop xmlns="DAV:"><sync-token/></prop>"#; let got = deserialize::<dav::PropName<All>>(src).await; |