diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-01 10:29:16 +0100 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-03-01 10:29:16 +0100 |
commit | c52a6591512825d297b0636cc228ee0915974404 (patch) | |
tree | 9b415d208ab8d246b589f80e4b91243f69a4d726 /src/dav/calencoder.rs | |
parent | 929a185f371a7f369c4437d47b5c9e9f414678cf (diff) | |
download | aerogramme-c52a6591512825d297b0636cc228ee0915974404.tar.gz aerogramme-c52a6591512825d297b0636cc228ee0915974404.zip |
hook resource type
Diffstat (limited to 'src/dav/calencoder.rs')
-rw-r--r-- | src/dav/calencoder.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dav/calencoder.rs b/src/dav/calencoder.rs index 14b7903..fc380ac 100644 --- a/src/dav/calencoder.rs +++ b/src/dav/calencoder.rs @@ -23,6 +23,10 @@ impl Context for CalExtension { async fn hook_property(&self, prop: &Self::Property, xml: &mut Writer<impl AsyncWrite+Unpin>) -> Result<(), QError> { prop.write(xml, self.child()).await } + + async fn hook_resourcetype(&self, restype: &Self::ResourceType, xml: &mut Writer<impl AsyncWrite+Unpin>) -> Result<(), QError> { + restype.write(xml, self.child()).await + } } impl CalExtension { @@ -58,7 +62,13 @@ impl QuickWritable<CalExtension> for Property { } } - +impl QuickWritable<CalExtension> for ResourceType { + async fn write(&self, xml: &mut Writer<impl AsyncWrite+Unpin>, ctx: CalExtension) -> Result<(), QError> { + match self { + Self::Calendar => xml.write_event_async(Event::Empty(ctx.create_dav_element("calendar"))).await, + } + } +} #[cfg(test)] mod tests { |