Kantoor. Feeds. Parser
(Kantoor v1.0.0)
Turns the body of a feed into the calendar objects Kantoor stores: one object per
UID, holding the event, all its overrides (RECURRENCE-ID, cancelled instances
included) and the VTIMEZONEs it uses, as a CalDAV client expects to find them.
Uses the same iCalendar code as the rest of Kantoor (Kantoor.Dav.Ical). What it
does to a feed:
- keeps only
VEVENTs (tasks and journals in a feed are ignored) that have a readableDTSTART; the others are counted inskipped; - drops the calendar-level
METHOD(a stored calendar object must not carry one, RFC 4791 section 4.1) and theX-WR-*and refresh hints, keepingVERSIONandPRODID; - keeps
STATUS:CANCELLEDevents and instances as they are: a cancelled instance stays in the series so the occurrence is not generated; - gives an event without a
UIDa stable one derived from its content; - rewrites a
TZIDthat is not a known time zone name to the one it stands for when the feed says so (X-LIC-LOCATIONin itsVTIMEZONE) or it is a common Windows zone name, so an Outlook or libical feed shows at the right hour; - names each object after its UID (made safe), so the same event keeps the same name on every fetch and CalDAV clients see changes, not replacements.
A feed that is not iCalendar is {:error, "not_calendar"}; one with more than
5000 events is {:error, "too_many_events"}. Nothing is stored here.
Summary
Functions
Parses body. See the module doc.
Types
Functions
@spec parse(binary()) :: {:ok, %{objects: [object()], skipped: non_neg_integer()}} | {:error, String.t()}
Parses body. See the module doc.