aboutsummaryrefslogtreecommitdiff
path: root/src/dav/calencoder.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-03-03 11:00:10 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-03-03 11:00:10 +0100
commit433e1f97f6d83bc11134df36de03e47b9393582b (patch)
tree8070069b064d196cd4f70cb0936d0a5a3e1a29a6 /src/dav/calencoder.rs
parent99f8085e475f8d55ab365c71d5fbd48cf3dc94c6 (diff)
downloadaerogramme-433e1f97f6d83bc11134df36de03e47b9393582b.tar.gz
aerogramme-433e1f97f6d83bc11134df36de03e47b9393582b.zip
Param-filter encoding
Diffstat (limited to 'src/dav/calencoder.rs')
-rw-r--r--src/dav/calencoder.rs33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/dav/calencoder.rs b/src/dav/calencoder.rs
index ca314f1..503d48b 100644
--- a/src/dav/calencoder.rs
+++ b/src/dav/calencoder.rs
@@ -593,19 +593,46 @@ impl<C: CalContext> QuickWritable<C> for TimeOrText {
impl<C: CalContext> QuickWritable<C> for TextMatch {
async fn write(&self, xml: &mut Writer<impl AsyncWrite+Unpin>, ctx: C) -> Result<(), QError> {
- unimplemented!();
+ let mut start = ctx.create_cal_element("text-match");
+ if let Some(collation) = &self.collation {
+ start.push_attribute(("collation", collation.as_str()));
+ }
+ match self.negate_condition {
+ None => (),
+ Some(true) => start.push_attribute(("negate-condition", "yes")),
+ Some(false) => start.push_attribute(("negate-condition", "no")),
+ }
+ let end = start.to_end();
+
+ xml.write_event_async(Event::Start(start.clone())).await?;
+ xml.write_event_async(Event::Text(BytesText::new(self.text.as_str()))).await?;
+ xml.write_event_async(Event::End(end)).await
}
}
impl<C: CalContext> QuickWritable<C> for ParamFilter {
async fn write(&self, xml: &mut Writer<impl AsyncWrite+Unpin>, ctx: C) -> Result<(), QError> {
- unimplemented!();
+ let mut start = ctx.create_cal_element("param-filter");
+ start.push_attribute(("name", self.name.as_str()));
+
+ match &self.additional_rules {
+ None => xml.write_event_async(Event::Empty(start)).await,
+ Some(rules) => {
+ let end = start.to_end();
+ xml.write_event_async(Event::Start(start.clone())).await?;
+ rules.write(xml, ctx.child()).await?;
+ xml.write_event_async(Event::End(end)).await
+ }
+ }
}
}
impl<C: CalContext> QuickWritable<C> for ParamFilterMatch {
async fn write(&self, xml: &mut Writer<impl AsyncWrite+Unpin>, ctx: C) -> Result<(), QError> {
- unimplemented!();
+ match self {
+ Self::IsNotDefined => xml.write_event_async(Event::Empty(ctx.create_dav_element("is-not-defined"))).await,
+ Self::Match(tm) => tm.write(xml, ctx).await,
+ }
}
}