mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 14:02:29 +00:00
caldav: Support VJOURNAL
This commit is contained in:
@@ -7,7 +7,7 @@ a calendar server
|
|||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
- [ ] CalDAV
|
- [ ] CalDAV
|
||||||
- [x] Support for VEVENT, VTODO
|
- [x] Support for VEVENT, VTODO, VJOURNAL
|
||||||
- [ ] Proper filtering for REPORT method
|
- [ ] Proper filtering for REPORT method
|
||||||
- [x] comp-filter
|
- [x] comp-filter
|
||||||
- [x] time-range filter
|
- [x] time-range filter
|
||||||
|
|||||||
@@ -143,6 +143,9 @@ impl Resource for CalendarResource {
|
|||||||
SupportedCalendarComponent {
|
SupportedCalendarComponent {
|
||||||
name: "VTODO".to_owned(),
|
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 calendar;
|
||||||
pub mod event;
|
pub mod event;
|
||||||
|
pub mod journal;
|
||||||
pub mod object;
|
pub mod object;
|
||||||
pub mod todo;
|
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 crate::{timestamp::CalDateTime, Error};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ical::parser::{ical::component::IcalTimeZone, Component};
|
use ical::parser::{ical::component::IcalTimeZone, Component};
|
||||||
@@ -18,6 +18,7 @@ pub enum CalendarObjectType {
|
|||||||
pub enum CalendarObjectComponent {
|
pub enum CalendarObjectComponent {
|
||||||
Event(EventObject),
|
Event(EventObject),
|
||||||
Todo(TodoObject),
|
Todo(TodoObject),
|
||||||
|
Journal(JournalObject),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
@@ -113,6 +114,15 @@ impl CalendarObject {
|
|||||||
data: CalendarObjectComponent::Todo(TodoObject { todo: todo.clone() }),
|
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(
|
Err(Error::InvalidData(
|
||||||
"iCalendar component type not supported :(".to_owned(),
|
"iCalendar component type not supported :(".to_owned(),
|
||||||
@@ -137,6 +147,7 @@ impl CalendarObject {
|
|||||||
match self.data {
|
match self.data {
|
||||||
CalendarObjectComponent::Todo(_) => "VTODO",
|
CalendarObjectComponent::Todo(_) => "VTODO",
|
||||||
CalendarObjectComponent::Event(_) => "VEVENT",
|
CalendarObjectComponent::Event(_) => "VEVENT",
|
||||||
|
CalendarObjectComponent::Journal(_) => "VJOURNAL",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user