Bump to calcard 0.2
This commit is contained in:
@@ -9,11 +9,11 @@ use crate::{DavError, calendar::query::is_resource_in_time_range, common::uri::D
|
||||
use calcard::{
|
||||
common::{PartialDateTime, timezone::Tz},
|
||||
icalendar::{
|
||||
ArchivedICalendarComponentType, ArchivedICalendarEntry, ArchivedICalendarParameter,
|
||||
ArchivedICalendarProperty, ArchivedICalendarStatus, ArchivedICalendarValue, ICalendar,
|
||||
ICalendarComponent, ICalendarComponentType, ICalendarEntry, ICalendarFreeBusyType,
|
||||
ICalendarParameter, ICalendarPeriod, ICalendarProperty, ICalendarTransparency,
|
||||
ICalendarValue,
|
||||
ArchivedICalendarComponentType, ArchivedICalendarEntry, ArchivedICalendarParameterName,
|
||||
ArchivedICalendarParameterValue, ArchivedICalendarProperty, ArchivedICalendarStatus,
|
||||
ArchivedICalendarValue, ICalendar, ICalendarComponent, ICalendarComponentType,
|
||||
ICalendarEntry, ICalendarFreeBusyType, ICalendarParameter, ICalendarPeriod,
|
||||
ICalendarProperty, ICalendarTransparency, ICalendarValue,
|
||||
},
|
||||
};
|
||||
use common::{DavResourcePath, DavResources, PROD_ID, Server, auth::AccessToken};
|
||||
@@ -200,7 +200,7 @@ impl CalendarFreebusyRequestHandler for Server {
|
||||
}
|
||||
|
||||
for (component_id, component) in components {
|
||||
let component_id = component_id as u16;
|
||||
let component_id = component_id as u32;
|
||||
match component.component_type {
|
||||
ArchivedICalendarComponentType::VEvent => {
|
||||
let fbtype = match component.status() {
|
||||
@@ -208,9 +208,6 @@ impl CalendarFreebusyRequestHandler for Server {
|
||||
Some(ArchivedICalendarStatus::Tentative) => {
|
||||
ICalendarFreeBusyType::BusyTentative
|
||||
}
|
||||
Some(ArchivedICalendarStatus::Other(v)) => {
|
||||
ICalendarFreeBusyType::Other(v.as_str().to_string())
|
||||
}
|
||||
_ => ICalendarFreeBusyType::Busy,
|
||||
};
|
||||
|
||||
@@ -240,8 +237,10 @@ impl CalendarFreebusyRequestHandler for Server {
|
||||
.params
|
||||
.iter()
|
||||
.find_map(|param| {
|
||||
if let ArchivedICalendarParameter::Fbtype(param) =
|
||||
param
|
||||
if let (
|
||||
ArchivedICalendarParameterName::Fbtype,
|
||||
ArchivedICalendarParameterValue::Fbtype(param),
|
||||
) = (¶m.name, ¶m.value)
|
||||
{
|
||||
rkyv_deserialize(param).ok()
|
||||
} else {
|
||||
@@ -263,7 +262,7 @@ impl CalendarFreebusyRequestHandler for Server {
|
||||
for (fbtype, events_in_range) in fb_entries {
|
||||
entries.push(ICalendarEntry {
|
||||
name: ICalendarProperty::Freebusy,
|
||||
params: vec![ICalendarParameter::Fbtype(fbtype)],
|
||||
params: vec![ICalendarParameter::fbtype(fbtype)],
|
||||
values: merge_intervals(events_in_range),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ impl CalendarQueryHandler {
|
||||
FilterOp::Exists => true,
|
||||
FilterOp::Undefined => false,
|
||||
FilterOp::TextMatch(text_match) => {
|
||||
if let Some(text) = entry.as_text() {
|
||||
if let Some(text) = entry.value.as_text() {
|
||||
text_match.matches(text)
|
||||
} else {
|
||||
false
|
||||
@@ -363,7 +363,7 @@ impl CalendarQueryHandler {
|
||||
FilterOp::TimeRange(range) => {
|
||||
if !matches!(comp.last(), Some(ICalendarComponentType::VAlarm)) {
|
||||
let matching_comp_ids = find_components(ical, comp)
|
||||
.map(|(id, comp)| (id as u16, &comp.component_type))
|
||||
.map(|(id, comp)| (id as u32, &comp.component_type))
|
||||
.collect::<AHashMap<_, _>>();
|
||||
|
||||
!matching_comp_ids.is_empty()
|
||||
@@ -381,14 +381,14 @@ impl CalendarQueryHandler {
|
||||
.data
|
||||
.alarms
|
||||
.iter()
|
||||
.map(|alarm| alarm.parent_id.to_native())
|
||||
.map(|alarm| alarm.parent_id.to_native() as u32)
|
||||
.collect::<AHashSet<_>>();
|
||||
|
||||
!matching_comp_ids.is_empty()
|
||||
&& self.expanded_times.iter().any(|time| {
|
||||
matching_comp_ids.contains(&time.comp_id)
|
||||
&& event.data.alarms.iter().any(|alarm| {
|
||||
alarm.parent_id.to_native() == time.comp_id
|
||||
alarm.parent_id.to_native() as u32 == time.comp_id
|
||||
&& alarm
|
||||
.delta
|
||||
.to_timestamp(
|
||||
@@ -428,8 +428,8 @@ impl CalendarQueryHandler {
|
||||
) -> Option<String> {
|
||||
let mut out = String::with_capacity(event.size.to_native() as usize);
|
||||
let _v = [0.into()];
|
||||
let mut component_iter: Iter<'_, rkyv::rend::u16_le> = _v.iter();
|
||||
let mut component_stack: Vec<(&ArchivedICalendarComponent, Iter<'_, rkyv::rend::u16_le>)> =
|
||||
let mut component_iter: Iter<'_, rkyv::rend::u32_le> = _v.iter();
|
||||
let mut component_stack: Vec<(&ArchivedICalendarComponent, Iter<'_, rkyv::rend::u32_le>)> =
|
||||
Vec::with_capacity(4);
|
||||
|
||||
if data.expand.is_some() {
|
||||
@@ -653,5 +653,5 @@ fn find_parameter<'x>(
|
||||
entry: &'x ArchivedICalendarEntry,
|
||||
name: &ICalendarParameterName,
|
||||
) -> Option<&'x ArchivedICalendarParameter> {
|
||||
entry.params.iter().find(|param| param.matches_name(name))
|
||||
entry.params.iter().find(|param| param.name == *name)
|
||||
}
|
||||
|
||||
@@ -282,10 +282,10 @@ impl CalendarSchedulingHandler for Server {
|
||||
let tz_id = entry.tz_id();
|
||||
match (&entry.name, entry.values.first()) {
|
||||
(ICalendarProperty::Dtstart, Some(ICalendarValue::PartialDateTime(dt))) => {
|
||||
from_date = dt.to_date_time_with_tz(tz_resolver.resolve(tz_id));
|
||||
from_date = dt.to_date_time_with_tz(tz_resolver.resolve_or_default(tz_id));
|
||||
}
|
||||
(ICalendarProperty::Dtend, Some(ICalendarValue::PartialDateTime(dt))) => {
|
||||
to_date = dt.to_date_time_with_tz(tz_resolver.resolve(tz_id));
|
||||
to_date = dt.to_date_time_with_tz(tz_resolver.resolve_or_default(tz_id));
|
||||
}
|
||||
(ICalendarProperty::Uid, Some(ICalendarValue::Text(_))) => {
|
||||
uid = Some(entry);
|
||||
|
||||
@@ -157,7 +157,7 @@ pub(crate) fn vcard_query(card: &ArchivedVCard, filters: &AddressbookFilter) ->
|
||||
FilterOp::Exists => true,
|
||||
FilterOp::Undefined => false,
|
||||
FilterOp::TextMatch(text_match) => {
|
||||
if let Some(text) = entry.as_text() {
|
||||
if let Some(text) = entry.value.as_text() {
|
||||
text_match.matches(text)
|
||||
} else {
|
||||
false
|
||||
@@ -197,7 +197,7 @@ fn find_parameter<'x>(
|
||||
entry: &'x ArchivedVCardEntry,
|
||||
name: &VCardParameterName,
|
||||
) -> Option<&'x ArchivedVCardParameter> {
|
||||
entry.params.iter().find(|param| param.matches_name(name))
|
||||
entry.params.iter().find(|param| param.name == *name)
|
||||
}
|
||||
|
||||
pub(crate) fn serialize_vcard_with_props(
|
||||
|
||||
Reference in New Issue
Block a user