aboutsummaryrefslogtreecommitdiff
path: root/aero-dav
diff options
context:
space:
mode:
Diffstat (limited to 'aero-dav')
-rw-r--r--aero-dav/src/syncdecoder.rs14
-rw-r--r--aero-dav/src/syncencoder.rs7
-rw-r--r--aero-dav/src/synctypes.rs2
-rw-r--r--aero-dav/src/versioningdecoder.rs2
4 files changed, 13 insertions, 12 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;
diff --git a/aero-dav/src/syncencoder.rs b/aero-dav/src/syncencoder.rs
index 8badc92..2dd50eb 100644
--- a/aero-dav/src/syncencoder.rs
+++ b/aero-dav/src/syncencoder.rs
@@ -16,7 +16,10 @@ impl QWrite for Property {
impl QWrite for PropertyRequest {
async fn qwrite(&self, xml: &mut Writer<impl IWrite>) -> Result<(), QError> {
match self {
- Self::SyncToken(token) => token.qwrite(xml).await,
+ Self::SyncToken => {
+ let start = xml.create_dav_element("sync-token");
+ xml.q.write_event_async(Event::Empty(start)).await
+ }
}
}
}
@@ -180,7 +183,7 @@ mod tests {
async fn prop_req() {
serialize_deserialize(&dav::PropName::<All>(vec![
dav::PropertyRequest::Extension(realization::PropertyRequest::Sync(
- PropertyRequest::SyncToken(SyncTokenRequest::InitialSync),
+ PropertyRequest::SyncToken,
)),
]))
.await;
diff --git a/aero-dav/src/synctypes.rs b/aero-dav/src/synctypes.rs
index cbd86b8..2a14221 100644
--- a/aero-dav/src/synctypes.rs
+++ b/aero-dav/src/synctypes.rs
@@ -6,7 +6,7 @@ use super::versioningtypes as vers;
#[derive(Debug, PartialEq, Clone)]
pub enum PropertyRequest {
- SyncToken(SyncTokenRequest),
+ SyncToken,
}
#[derive(Debug, PartialEq, Clone)]
diff --git a/aero-dav/src/versioningdecoder.rs b/aero-dav/src/versioningdecoder.rs
index c28c0d5..a0a3ddf 100644
--- a/aero-dav/src/versioningdecoder.rs
+++ b/aero-dav/src/versioningdecoder.rs
@@ -21,7 +21,7 @@ impl QRead<PropertyRequest> for PropertyRequest {
impl<E: dav::Extension> QRead<Property<E>> for Property<E> {
async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> {
if xml
- .maybe_open(DAV_URN, "supported-report-set")
+ .maybe_open_start(DAV_URN, "supported-report-set")
.await?
.is_some()
{