mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 22:52:22 +00:00
caldav: Support VJOURNAL
This commit is contained in:
@@ -7,7 +7,7 @@ a calendar server
|
||||
## Todo
|
||||
|
||||
- [ ] CalDAV
|
||||
- [x] Support for VEVENT, VTODO
|
||||
- [x] Support for VEVENT, VTODO, VJOURNAL
|
||||
- [ ] Proper filtering for REPORT method
|
||||
- [x] comp-filter
|
||||
- [x] time-range filter
|
||||
|
||||
@@ -143,6 +143,9 @@ impl Resource for CalendarResource {
|
||||
SupportedCalendarComponent {
|
||||
name: "VTODO".to_owned(),
|
||||
},
|
||||
SupportedCalendarComponent {
|
||||
name: "VJOURNAL".to_owned(),
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
6
crates/store/src/model/journal.rs
Normal file
6
crates/store/src/model/journal.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
use ical::parser::ical::component::IcalJournal;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct JournalObject {
|
||||
pub(crate) journal: IcalJournal,
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod calendar;
|
||||
pub mod event;
|
||||
pub mod journal;
|
||||
pub mod object;
|
||||
pub mod todo;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::{event::EventObject, todo::TodoObject};
|
||||
use super::{event::EventObject, journal::JournalObject, todo::TodoObject};
|
||||
use crate::{timestamp::CalDateTime, Error};
|
||||
use anyhow::Result;
|
||||
use ical::parser::{ical::component::IcalTimeZone, Component};
|
||||
@@ -18,6 +18,7 @@ pub enum CalendarObjectType {
|
||||
pub enum CalendarObjectComponent {
|
||||
Event(EventObject),
|
||||
Todo(TodoObject),
|
||||
Journal(JournalObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -113,6 +114,15 @@ impl CalendarObject {
|
||||
data: CalendarObjectComponent::Todo(TodoObject { todo: todo.clone() }),
|
||||
});
|
||||
}
|
||||
if let Some(journal) = cal.journals.first() {
|
||||
return Ok(CalendarObject {
|
||||
id: object_id,
|
||||
ics,
|
||||
data: CalendarObjectComponent::Journal(JournalObject {
|
||||
journal: journal.clone(),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
Err(Error::InvalidData(
|
||||
"iCalendar component type not supported :(".to_owned(),
|
||||
@@ -137,6 +147,7 @@ impl CalendarObject {
|
||||
match self.data {
|
||||
CalendarObjectComponent::Todo(_) => "VTODO",
|
||||
CalendarObjectComponent::Event(_) => "VEVENT",
|
||||
CalendarObjectComponent::Journal(_) => "VJOURNAL",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user