mirror of
https://github.com/lennart-k/rustical.git
synced 2026-01-30 09:18:22 +00:00
Migrate ical-rs to caldata-rs
This commit is contained in:
@@ -34,7 +34,7 @@ rustical_store.workspace = true
|
||||
chrono.workspace = true
|
||||
chrono-tz.workspace = true
|
||||
sha2.workspace = true
|
||||
ical.workspace = true
|
||||
caldata.workspace = true
|
||||
percent-encoding.workspace = true
|
||||
rustical_xml.workspace = true
|
||||
uuid.workspace = true
|
||||
|
||||
@@ -3,11 +3,11 @@ use crate::calendar::CalendarResourceService;
|
||||
use axum::body::Body;
|
||||
use axum::extract::State;
|
||||
use axum::{extract::Path, response::Response};
|
||||
use caldata::component::IcalCalendar;
|
||||
use caldata::generator::Emitter;
|
||||
use caldata::parser::ContentLine;
|
||||
use headers::{ContentType, HeaderMapExt};
|
||||
use http::{HeaderValue, Method, StatusCode, header};
|
||||
use ical::component::IcalCalendar;
|
||||
use ical::generator::Emitter;
|
||||
use ical::property::ContentLine;
|
||||
use percent_encoding::{CONTROLS, utf8_percent_encode};
|
||||
use rustical_store::{CalendarStore, SubscriptionStore, auth::Principal};
|
||||
use std::str::FromStr;
|
||||
|
||||
@@ -4,8 +4,9 @@ use axum::{
|
||||
extract::{Path, State},
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use caldata::IcalParser;
|
||||
use caldata::component::{Component, ComponentMut};
|
||||
use http::StatusCode;
|
||||
use ical::parser::{Component, ComponentMut};
|
||||
use rustical_dav::header::Overwrite;
|
||||
use rustical_ical::CalendarObjectType;
|
||||
use rustical_store::{
|
||||
@@ -25,7 +26,7 @@ pub async fn route_import<C: CalendarStore, S: SubscriptionStore>(
|
||||
return Err(Error::Unauthorized);
|
||||
}
|
||||
|
||||
let parser = ical::IcalParser::from_slice(body.as_bytes());
|
||||
let parser = IcalParser::from_slice(body.as_bytes());
|
||||
let mut cal = match parser.expect_one() {
|
||||
Ok(cal) => cal.mutable(),
|
||||
Err(err) => return Ok((StatusCode::BAD_REQUEST, err.to_string()).into_response()),
|
||||
|
||||
@@ -6,8 +6,8 @@ use crate::calendar::prop::SupportedCalendarComponentSet;
|
||||
use crate::error::Precondition;
|
||||
use axum::extract::{Path, State};
|
||||
use axum::response::{IntoResponse, Response};
|
||||
use caldata::IcalParser;
|
||||
use http::{Method, StatusCode};
|
||||
use ical::IcalParser;
|
||||
use rustical_dav::xml::HrefElement;
|
||||
use rustical_ical::CalendarObjectType;
|
||||
use rustical_store::auth::Principal;
|
||||
|
||||
@@ -2,9 +2,12 @@ use crate::calendar::methods::report::calendar_query::{
|
||||
TimeRangeElement,
|
||||
prop_filter::{PropFilterElement, PropFilterable},
|
||||
};
|
||||
use ical::{
|
||||
component::{CalendarInnerData, IcalAlarm, IcalCalendarObject, IcalEvent, IcalTodo},
|
||||
parser::{Component, ical::component::IcalTimeZone},
|
||||
use caldata::{
|
||||
component::{
|
||||
CalendarInnerData, Component, IcalAlarm, IcalCalendarObject, IcalEvent, IcalTimeZone,
|
||||
IcalTodo,
|
||||
},
|
||||
parser::ContentLine,
|
||||
};
|
||||
use rustical_xml::XmlDeserialize;
|
||||
|
||||
@@ -112,10 +115,7 @@ impl CompFilterable for CalendarInnerData {
|
||||
}
|
||||
|
||||
impl PropFilterable for IcalAlarm {
|
||||
fn get_named_properties<'a>(
|
||||
&'a self,
|
||||
name: &'a str,
|
||||
) -> impl Iterator<Item = &'a ical::property::ContentLine> {
|
||||
fn get_named_properties<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a ContentLine> {
|
||||
Component::get_named_properties(self, name)
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ impl PropFilterable for CalendarInnerData {
|
||||
fn get_named_properties<'a>(
|
||||
&'a self,
|
||||
name: &'a str,
|
||||
) -> Box<dyn Iterator<Item = &'a ical::property::ContentLine> + 'a> {
|
||||
) -> Box<dyn Iterator<Item = &'a ContentLine> + 'a> {
|
||||
// TODO: If we were pedantic, we would have to do recurrence expansion first
|
||||
// and take into account the overrides :(
|
||||
match self {
|
||||
@@ -151,10 +151,7 @@ impl PropFilterable for CalendarInnerData {
|
||||
}
|
||||
|
||||
impl PropFilterable for IcalCalendarObject {
|
||||
fn get_named_properties<'a>(
|
||||
&'a self,
|
||||
name: &'a str,
|
||||
) -> impl Iterator<Item = &'a ical::property::ContentLine> {
|
||||
fn get_named_properties<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a ContentLine> {
|
||||
Component::get_named_properties(self, name)
|
||||
}
|
||||
}
|
||||
@@ -185,10 +182,7 @@ impl CompFilterable for IcalCalendarObject {
|
||||
}
|
||||
|
||||
impl PropFilterable for IcalTimeZone {
|
||||
fn get_named_properties<'a>(
|
||||
&'a self,
|
||||
name: &'a str,
|
||||
) -> impl Iterator<Item = &'a ical::property::ContentLine> {
|
||||
fn get_named_properties<'a>(&'a self, name: &'a str) -> impl Iterator<Item = &'a ContentLine> {
|
||||
Component::get_named_properties(self, name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::comp_filter::{CompFilterElement, CompFilterable};
|
||||
use crate::calendar_object::CalendarObjectPropWrapperName;
|
||||
use ical::{component::IcalCalendarObject, property::ContentLine};
|
||||
use caldata::{component::IcalCalendarObject, parser::ContentLine};
|
||||
use rustical_dav::xml::{PropfindType, TextMatchElement};
|
||||
use rustical_ical::UtcDateTime;
|
||||
use rustical_store::calendar_store::CalendarQuery;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::{ParamFilterElement, TimeRangeElement};
|
||||
use ical::{property::ContentLine, types::CalDateTime};
|
||||
use caldata::{parser::ContentLine, types::CalDateTime};
|
||||
use rustical_dav::xml::TextMatchElement;
|
||||
use rustical_ical::UtcDateTime;
|
||||
use rustical_xml::XmlDeserialize;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::prop::{SupportedCalendarComponentSet, SupportedCalendarData};
|
||||
use crate::Error;
|
||||
use crate::calendar::prop::{ReportMethod, SupportedCollationSet};
|
||||
use caldata::IcalParser;
|
||||
use caldata::types::CalDateTime;
|
||||
use chrono::{DateTime, Utc};
|
||||
use derive_more::derive::{From, Into};
|
||||
use ical::IcalParser;
|
||||
use ical::types::CalDateTime;
|
||||
use rustical_dav::extensions::{
|
||||
CommonPropertiesExtension, CommonPropertiesProp, SyncTokenExtension, SyncTokenExtensionProp,
|
||||
};
|
||||
|
||||
@@ -3,8 +3,8 @@ use super::prop::{
|
||||
CalendarObjectPropWrapperName,
|
||||
};
|
||||
use crate::Error;
|
||||
use caldata::generator::Emitter;
|
||||
use derive_more::derive::{From, Into};
|
||||
use ical::generator::Emitter;
|
||||
use rustical_dav::{
|
||||
extensions::CommonPropertiesExtension,
|
||||
privileges::UserPrivilegeSet,
|
||||
|
||||
Reference in New Issue
Block a user