clean up ical-related stuff

This commit is contained in:
Lennart K
2026-01-08 14:31:28 +01:00
parent a2255bc7f1
commit 5639127782
5 changed files with 5574 additions and 163 deletions

View File

@@ -68,14 +68,8 @@ pub struct CalendarObject {
impl CalendarObject {
pub fn from_ics(ics: String) -> Result<Self, Error> {
let mut parser: ComponentParser<_, IcalCalendarObject> =
ComponentParser::new(ics.as_bytes());
let inner = parser.next().ok_or(Error::MissingCalendar)??;
if parser.next().is_some() {
return Err(Error::InvalidData(
"multiple calendars, only one allowed".to_owned(),
));
}
let parser: ComponentParser<_, IcalCalendarObject> = ComponentParser::new(ics.as_bytes());
let inner = parser.expect_one()?;
Ok(Self { inner, ics })
}