diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-08 21:51:34 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-08 21:51:34 +0100 |
commit | f50f6d68aa8c3bc363fb71bc75a2c1f78f14803f (patch) | |
tree | 6700221106b68c66858c5e759e21e615c3d1cc00 /aero-dav | |
parent | 17e42874f5a881d5cf55fb8f5e554b003fb59b96 (diff) | |
download | aerogramme-f50f6d68aa8c3bc363fb71bc75a2c1f78f14803f.tar.gz aerogramme-f50f6d68aa8c3bc363fb71bc75a2c1f78f14803f.zip |
finalize decoder caldav impl
Diffstat (limited to 'aero-dav')
-rw-r--r-- | aero-dav/src/caldecoder.rs | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/aero-dav/src/caldecoder.rs b/aero-dav/src/caldecoder.rs index 11e191f..1a096c1 100644 --- a/aero-dav/src/caldecoder.rs +++ b/aero-dav/src/caldecoder.rs @@ -230,14 +230,61 @@ impl QRead<Property> for Property { } impl QRead<PropertyRequest> for PropertyRequest { - async fn qread(_xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> { - unreachable!(); + async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> { + if xml.maybe_open(CAL_URN, "calendar-description").await?.is_some() { + xml.close().await?; + return Ok(Self::CalendarDescription) + } + if xml.maybe_open(CAL_URN, "calendar-timezone").await?.is_some() { + xml.close().await?; + return Ok(Self::CalendarTimezone) + } + if xml.maybe_open(CAL_URN, "supported-calendar-component-set").await?.is_some() { + xml.close().await?; + return Ok(Self::SupportedCalendarComponentSet) + } + if xml.maybe_open(CAL_URN, "supported-calendar-data").await?.is_some() { + xml.close().await?; + return Ok(Self::SupportedCalendarData) + } + if xml.maybe_open(CAL_URN, "max-resource-size").await?.is_some() { + xml.close().await?; + return Ok(Self::MaxResourceSize) + } + if xml.maybe_open(CAL_URN, "min-date-time").await?.is_some() { + xml.close().await?; + return Ok(Self::MinDateTime) + } + if xml.maybe_open(CAL_URN, "max-date-time").await?.is_some() { + xml.close().await?; + return Ok(Self::MaxDateTime) + } + if xml.maybe_open(CAL_URN, "max-instances").await?.is_some() { + xml.close().await?; + return Ok(Self::MaxInstances) + } + if xml.maybe_open(CAL_URN, "max-attendees-per-instance").await?.is_some() { + xml.close().await?; + return Ok(Self::MaxAttendeesPerInstance) + } + if xml.maybe_open(CAL_URN, "supported-collation-set").await?.is_some() { + xml.close().await?; + return Ok(Self::SupportedCollationSet) + } + 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::CalendarData) } } impl QRead<ResourceType> for ResourceType { - async fn qread(_xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> { - unreachable!(); + async fn qread(xml: &mut Reader<impl IRead>) -> Result<Self, ParsingError> { + if xml.maybe_open(CAL_URN, "calendar").await?.is_some() { + xml.close().await?; + return Ok(Self::Calendar) + } + Err(ParsingError::Recoverable) } } |