From 5bf3517acfea3694fbe586e69a0e02b94c61eb1b Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 18 Mar 2024 22:56:49 +0100 Subject: Pass thunderbird autodetect... --- aero-dav/src/caldecoder.rs | 9 +++++++++ aero-dav/src/calencoder.rs | 8 ++++++++ aero-dav/src/caltypes.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) (limited to 'aero-dav/src') diff --git a/aero-dav/src/caldecoder.rs b/aero-dav/src/caldecoder.rs index dbc6e18..b124154 100644 --- a/aero-dav/src/caldecoder.rs +++ b/aero-dav/src/caldecoder.rs @@ -162,6 +162,11 @@ impl QRead for Violation { impl QRead for Property { async fn qread(xml: &mut Reader) -> Result { + if xml.maybe_open_start(CAL_URN, "calendar-home-set").await?.is_some() { + let href = xml.find().await?; + xml.close().await?; + return Ok(Property::CalendarHomeSet(href)) + } if xml.maybe_open_start(CAL_URN, "calendar-description").await?.is_some() { let lang = xml.prev_attr("xml:lang"); let text = xml.tag_string().await?; @@ -231,6 +236,10 @@ impl QRead for Property { impl QRead for PropertyRequest { async fn qread(xml: &mut Reader) -> Result { + if xml.maybe_open(CAL_URN, "calendar-home-set").await?.is_some() { + xml.close().await?; + return Ok(Self::CalendarHomeSet) + } if xml.maybe_open(CAL_URN, "calendar-description").await?.is_some() { xml.close().await?; return Ok(Self::CalendarDescription) diff --git a/aero-dav/src/calencoder.rs b/aero-dav/src/calencoder.rs index 5323229..d4e79dc 100644 --- a/aero-dav/src/calencoder.rs +++ b/aero-dav/src/calencoder.rs @@ -88,6 +88,7 @@ impl QWrite for PropertyRequest { }; match self { + Self::CalendarHomeSet => atom("calendar-home-set").await, Self::CalendarDescription => atom("calendar-description").await, Self::CalendarTimezone => atom("calendar-timezone").await, Self::SupportedCalendarComponentSet => atom("supported-calendar-component-set").await, @@ -105,6 +106,13 @@ impl QWrite for PropertyRequest { impl QWrite for Property { async fn qwrite(&self, xml: &mut Writer) -> Result<(), QError> { match self { + Self::CalendarHomeSet(href) => { + let start = xml.create_cal_element("calendar-home-set"); + let end = start.to_end(); + xml.q.write_event_async(Event::Start(start.clone())).await?; + href.qwrite(xml).await?; + xml.q.write_event_async(Event::End(end)).await + } Self::CalendarDescription { lang, text } => { let mut start = xml.create_cal_element("calendar-description"); if let Some(the_lang) = lang { diff --git a/aero-dav/src/caltypes.rs b/aero-dav/src/caltypes.rs index 5ac50e6..aa056d4 100644 --- a/aero-dav/src/caltypes.rs +++ b/aero-dav/src/caltypes.rs @@ -116,6 +116,7 @@ pub enum ResourceType { /// Check the matching Property object for documentation #[derive(Debug, PartialEq, Clone)] pub enum PropertyRequest { + CalendarHomeSet, CalendarDescription, CalendarTimezone, SupportedCalendarComponentSet, @@ -131,6 +132,31 @@ pub enum PropertyRequest { #[derive(Debug, PartialEq, Clone)] pub enum Property { + /// Name: calendar-home-set + /// + /// Namespace: urn:ietf:params:xml:ns:caldav + /// + /// Purpose: Identifies the URL of any WebDAV collections that contain + /// calendar collections owned by the associated principal resource. + /// + /// Conformance: This property SHOULD be defined on a principal + /// resource. If defined, it MAY be protected and SHOULD NOT be + /// returned by a PROPFIND DAV:allprop request (as defined in Section + /// 12.14.1 of [RFC2518]). + /// + /// Description: The CALDAV:calendar-home-set property is meant to allow + /// users to easily find the calendar collections owned by the + /// principal. Typically, users will group all the calendar + /// collections that they own under a common collection. This + /// property specifies the URL of collections that are either calendar + /// collections or ordinary collections that have child or descendant + /// calendar collections owned by the principal. + /// + /// Definition: + /// + /// + CalendarHomeSet(dav::Href), + /// Name: calendar-description /// /// Namespace: urn:ietf:params:xml:ns:caldav -- cgit v1.2.3