diff --git a/Cargo.lock b/Cargo.lock
index 41bb1be8..ec6945c8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1797,6 +1797,7 @@ dependencies = [
"serde",
"serde_json",
"trc",
+ "types",
]
[[package]]
@@ -2852,7 +2853,6 @@ dependencies = [
"chrono",
"common",
"compact_str",
- "dav-proto",
"directory",
"hashify",
"percent-encoding",
diff --git a/crates/dav-proto/Cargo.toml b/crates/dav-proto/Cargo.toml
index f77a812d..2010cd7a 100644
--- a/crates/dav-proto/Cargo.toml
+++ b/crates/dav-proto/Cargo.toml
@@ -5,6 +5,7 @@ edition = "2021"
[dependencies]
trc = { path = "../trc" }
+types = { path = "../types" }
hashify = "0.2.6"
quick-xml = { version = "0.38" }
calcard = { path = "/Users/me/code/calcard", features = ["rkyv"] }
@@ -16,6 +17,7 @@ compact_str = "0.9.0"
[dev-dependencies]
calcard = { path = "/Users/me/code/calcard", features = ["serde", "rkyv"] }
+types = { path = "../types", features = ["test_mode"] }
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.138"
chrono = { version = "0.4.40", features = ["serde"] }
diff --git a/crates/dav-proto/src/parser/property.rs b/crates/dav-proto/src/parser/property.rs
index 57183b0a..8994fff2 100644
--- a/crates/dav-proto/src/parser/property.rs
+++ b/crates/dav-proto/src/parser/property.rs
@@ -4,6 +4,16 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
+use super::{tokenizer::Tokenizer, DavParser, RawElement, Token, XmlValueParser};
+use crate::schema::{
+ property::{
+ CalDavProperty, CalDavPropertyName, CalendarData, CardDavProperty, CardDavPropertyName,
+ Comp, DavProperty, DavValue, PrincipalProperty, ResourceType, WebDavProperty,
+ },
+ request::{DavPropertyValue, VCardPropertyWithGroup},
+ response::List,
+ Attribute, AttributeValue, Element, NamedElement, Namespace,
+};
use calcard::{
common::{IanaParse, PartialDateTime},
icalendar::{ICalendar, ICalendarComponentType, ICalendarParameterName, ICalendarProperty},
@@ -11,18 +21,7 @@ use calcard::{
Entry, Parser,
};
use mail_parser::DateTime;
-
-use crate::schema::{
- property::{
- CalDavProperty, CalDavPropertyName, CalendarData, CardDavProperty, CardDavPropertyName,
- Comp, DavProperty, DavValue, PrincipalProperty, ResourceType, TimeRange, WebDavProperty,
- },
- request::{DavPropertyValue, DeadProperty, VCardPropertyWithGroup},
- response::List,
- Attribute, AttributeValue, Element, NamedElement, Namespace,
-};
-
-use super::{tokenizer::Tokenizer, DavParser, RawElement, Token, XmlValueParser};
+use types::{dead_property::DeadProperty, TimeRange};
impl Tokenizer<'_> {
pub(crate) fn collect_properties(
@@ -384,18 +383,12 @@ impl Tokenizer<'_> {
}
}
-impl TimeRange {
- pub fn is_in_range(&self, match_overlap: bool, start: i64, end: i64) -> bool {
- if !match_overlap {
- // RFC4791#9.9: (start < DTEND AND end > DTSTART)
- self.start < end && self.end > start
- } else {
- // RFC4791#9.9: ((start < DUE) OR (start <= DTSTART)) AND ((end > DTSTART) OR (end >= DUE))
- ((start < self.end) || (start <= self.start)) && (end > self.start || end >= self.end)
- }
- }
+pub(crate) trait TimeRangeFromRaw {
+ fn from_raw(raw: &RawElement<'_>) -> super::Result