\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{<a href="https://wiki.horde.org/CalDAV">CalDAV</a> workflows for Kronolith}
\section{Create/Update (davPutObject)}
\begin{itemize}
\item rpc determines this is a dav request


\item delegates to RPC dav backend


\item Feeds into Sabre\textbackslash\{\}Dav\textbackslash\{\}Server


\item <a href="https://wiki.horde.org/SabreDAV">SabreDAV</a> stores the event to its calendar backend


\item horde/dav Calendar backend internally finds out the caldav name of the calendar is served by kronolith


\item Kronolith\_Application::davPutObject is called.


\item Resolve external calendar name to kronolith-internal calendar name


\item Perform some access checks


\item Parse icalendar data string into a Horde\_Icalendar object


\item Setup the Horde\_Icalendar\_Handler\_Dav with the calendar backend and the icalendar


\end{itemize}
Kronolith\_Icalendar\_Dav (inherits Kronolith\_Icalendar\_Base)

\begin{itemize}
\item Get all components of the calendar


\item ignore everything which is not a VEVENT


\item try to load an existing kronolith event


\item check if existing event last modified is newer / abort


\item keep a list of exception events from the VEVENT for later


\item Create a list of organizer and attendee(s) who signal by attribute that it's not the server's job to send them itip mails


\item Create the new kronolith\_Event base event object from the icalendar vevent


\item Delete all kronolith\_events which are exceptions on the base event from the backend<br />
run the post-save actions for the base event


\item check for missing mapping between external and internal event id, add if missing


\item handle decision-making on itip: Is the change relevant for itip (prevent spam). Who should get an itip? which type of itip to send out?


\end{itemize}
back in the main process

\begin{itemize}
\item create an kronolith\_event for each previously listed vevent exceptions and save it


\end{itemize}
\section{TODOs/Refactoring}
TODO: Factor out the iTip handling into a separate service which just takes previous and current event and possibly some intent control<br />
TODO: Make this flow unit testable (How?)<br />
TODO: Make the iTip flow reusable for web UI and inter-app API cases.

\section{Ajax saveEvent vs the davPutObject flow}
\begin{itemize}
\item UI has a different data/attribute format


\item more context or intent can be communicated ("as new", "send updates/no updates", "move event to different calendar"


\item more specific permission checks


\item Add event can check for a limit


\item edit event can check for edit permissions


\item very similar itip related code


\end{itemize}
\end{document}
