mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 08:12:24 +00:00
Rename events to calendar objects
This commit is contained in:
@@ -25,7 +25,7 @@ pub struct CalendarMultigetRequest {
|
||||
href: Vec<String>,
|
||||
}
|
||||
|
||||
pub async fn get_events_calendar_multiget<C: CalendarStore + ?Sized>(
|
||||
pub async fn get_objects_calendar_multiget<C: CalendarStore + ?Sized>(
|
||||
cal_query: &CalendarMultigetRequest,
|
||||
prefix: &str,
|
||||
principal: &str,
|
||||
@@ -68,8 +68,8 @@ pub async fn handle_calendar_multiget<C: CalendarStore + ?Sized>(
|
||||
cid: &str,
|
||||
cal_store: &RwLock<C>,
|
||||
) -> Result<MultistatusElement<PropstatWrapper<CalendarObjectProp>, String>, Error> {
|
||||
let events =
|
||||
get_events_calendar_multiget(&cal_multiget, prefix, principal, cid, cal_store).await?;
|
||||
let objects =
|
||||
get_objects_calendar_multiget(&cal_multiget, prefix, principal, cid, cal_store).await?;
|
||||
|
||||
let props = match cal_multiget.prop {
|
||||
PropfindType::Allprop => {
|
||||
@@ -84,10 +84,10 @@ pub async fn handle_calendar_multiget<C: CalendarStore + ?Sized>(
|
||||
let props: Vec<&str> = props.iter().map(String::as_str).collect();
|
||||
|
||||
let mut responses = Vec::new();
|
||||
for event in events {
|
||||
let path = format!("{}/{}", req.path(), event.get_uid());
|
||||
for object in objects {
|
||||
let path = format!("{}/{}", req.path(), object.get_uid());
|
||||
responses.push(
|
||||
CalendarObjectResource::from(event)
|
||||
CalendarObjectResource::from(object)
|
||||
.propfind(prefix, &path, props.clone())
|
||||
.await?,
|
||||
);
|
||||
|
||||
@@ -160,7 +160,7 @@ pub struct CalendarQueryRequest {
|
||||
timezone: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn get_events_calendar_query<C: CalendarStore + ?Sized>(
|
||||
pub async fn get_objects_calendar_query<C: CalendarStore + ?Sized>(
|
||||
cal_query: &CalendarQueryRequest,
|
||||
principal: &str,
|
||||
cid: &str,
|
||||
@@ -181,7 +181,7 @@ pub async fn handle_calendar_query<C: CalendarStore + ?Sized>(
|
||||
cid: &str,
|
||||
cal_store: &RwLock<C>,
|
||||
) -> Result<MultistatusElement<PropstatWrapper<CalendarObjectProp>, String>, Error> {
|
||||
let events = get_events_calendar_query(&cal_query, principal, cid, cal_store).await?;
|
||||
let objects = get_objects_calendar_query(&cal_query, principal, cid, cal_store).await?;
|
||||
|
||||
let props = match cal_query.prop {
|
||||
PropfindType::Allprop => {
|
||||
@@ -196,10 +196,10 @@ pub async fn handle_calendar_query<C: CalendarStore + ?Sized>(
|
||||
let props: Vec<&str> = props.iter().map(String::as_str).collect();
|
||||
|
||||
let mut responses = Vec::new();
|
||||
for event in events {
|
||||
let path = format!("{}/{}", req.path(), event.get_uid());
|
||||
for object in objects {
|
||||
let path = format!("{}/{}", req.path(), object.get_uid());
|
||||
responses.push(
|
||||
CalendarObjectResource::from(event)
|
||||
CalendarObjectResource::from(object)
|
||||
.propfind(prefix, &path, props.clone())
|
||||
.await?,
|
||||
);
|
||||
|
||||
@@ -63,24 +63,24 @@ pub async fn handle_sync_collection<C: CalendarStore + ?Sized>(
|
||||
let props: Vec<&str> = props.iter().map(String::as_str).collect();
|
||||
|
||||
let old_synctoken = parse_synctoken(&sync_collection.sync_token).unwrap_or(0);
|
||||
let (new_events, deleted_events, new_synctoken) = cal_store
|
||||
let (new_objects, deleted_objects, new_synctoken) = cal_store
|
||||
.read()
|
||||
.await
|
||||
.sync_changes(principal, cid, old_synctoken)
|
||||
.await?;
|
||||
|
||||
let mut responses = Vec::new();
|
||||
for event in new_events {
|
||||
let path = format!("{}/{}", req.path(), event.get_uid());
|
||||
for object in new_objects {
|
||||
let path = format!("{}/{}", req.path(), object.get_uid());
|
||||
responses.push(
|
||||
CalendarObjectResource::from(event)
|
||||
CalendarObjectResource::from(object)
|
||||
.propfind(prefix, &path, props.clone())
|
||||
.await?,
|
||||
);
|
||||
}
|
||||
|
||||
for event_uid in deleted_events {
|
||||
let path = format!("{}/{}", req.path(), event_uid);
|
||||
for object_uid in deleted_objects {
|
||||
let path = format!("{}/{}", req.path(), object_uid);
|
||||
responses.push(ResponseElement {
|
||||
href: path,
|
||||
status: Some(format!("HTTP/1.1 {}", StatusCode::NOT_FOUND)),
|
||||
|
||||
Reference in New Issue
Block a user