\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{ActiveSync Development}
Developer documentation for the Horde ActiveSync stack. \textbf{Horde 6 / ActiveSync 3.x.}

\section{Where to read what}
<table class="horde-table">Topic & Location \\
\hline
Protocol versions, EAS 16 features, deployment config, integrator API & <a href="https://github.com/horde/activesync/blob/FRAMEWORK_6_0/README.md">horde/activesync \texttt{README.md}</a> -- \textbf{canonical}, versioned with the library \\
\hline
Request flow, sync keys, class roles, tests & Same README -- \textit{Architecture} and \textit{Development and tests} sections \\
\hline
Open refactor work and Horde 6 breaking plans & <a href="https://github.com/horde/activesync/blob/FRAMEWORK_6_0/doc/todo.md">\texttt{doc/todo.md}</a> in the package repo \\
\hline
Operator setup, Autodiscover, web server & <a href="https://wiki.horde.org/ActiveSync">ActiveSync</a> wiki \\
\hline
Client quirks and server workarounds & <a href="https://wiki.horde.org/ActiveSync/BrokenClientBehavior">Broken Client Behavior</a> \\
\hline
Symptoms and unfixed client bugs & <a href="https://wiki.horde.org/ActiveSync/KnownIssues">Known Issues</a> \\
\hline
Feature matrix vs other servers & <a href="https://wiki.horde.org/ActiveSync/FeatureGrid">Feature Grid</a> \\
\hline
</table>
\textbf{Recommendation:} keep \textbf{architecture and protocol depth} in the git \texttt{README.md} so it stays aligned with releases. This wiki page covers \textbf{Horde deployment wiring} and points to the repo for everything else. The old long-form class tour and 2016 synclog walkthrough have been retired here in favour of the README.

\section{Package split}
ActiveSync logic spans two Composer packages in a normal Horde install:

\subsection{\texttt{horde/activesync} -- protocol engine}
Decodes WBXML, dispatches \texttt{Horde\_ActiveSync\_Request\_*} handlers, manages device<br />
state and sync keys, encodes responses. No direct Turba/Kronolith/IMP calls --<br />
all data access goes through \texttt{Horde\_ActiveSync\_Driver\_Base}.

Key areas: \texttt{Request/}, \texttt{Message/}, \texttt{State/}, \texttt{Wbxml/}, \texttt{Collections},<br />
\texttt{SyncCache}, \texttt{Connector/}, \texttt{Folder/}, \texttt{Imap/}, \texttt{Device.php}.

\subsection{\texttt{horde/core} -- Horde groupware backend}
\texttt{Horde\_Core\_ActiveSync\_Driver} implements the driver for IMP (mail), Kronolith,<br />
Turba, Nag, and Mnemo. Supporting classes:

<table class="horde-table">Class & Role \\
\hline
\texttt{Horde\_Core\_ActiveSync\_Auth} & Auth driver wrapper (Basic + optional certificate transparent driver) \\
\hline
\texttt{Horde\_Core\_ActiveSync\_Connector} & Registry calls into Horde apps \\
\hline
\texttt{Horde\_Core\_ActiveSync\_Mail} & Send / reply / forward \\
\hline
\texttt{Horde\_Core\_ActiveSync\_Imap\_Factory} & IMAP adapter and folder tree for mail \\
\hline
</table>
\subsection{Entry point}
\texttt{web/horde/rpc.php} -> \texttt{Horde\_Rpc\_ActiveSync} -> injector factories:

\begin{itemize}
\item \texttt{Horde\_Core\_Factory\_ActiveSyncServer} -- builds \texttt{Horde\_ActiveSync}, applies global \texttt{conf['activesync']['version']}


\item \texttt{Horde\_Core\_Factory\_ActiveSyncBackend} -- \texttt{Horde\_Core\_ActiveSync\_Driver}


\item \texttt{Horde\_Core\_Factory\_ActiveSyncState} -- SQL or Mongo state storage


\end{itemize}
EAS requests are \textbf{sessionless} (\texttt{\$session\_control = 'None'}); each HTTP hit<br />
bootstraps Horde without a web session cookie.

\texttt{OPTIONS} and \textbf{Autodiscover} (v1 XML and v2 JSON) are handled in the RPC<br />
layer before the normal command loop.

\section{Authentication note}
Clients send HTTP Basic credentials (or certificates with a transparent auth<br />
driver). \texttt{Horde\_ActiveSync\_Credentials} normalises usernames -- Autodiscover and<br />
some mobile clients use the \textbf{email address}; \texttt{getUsernameFromEmail()} in the<br />
core driver maps to the Horde account. This is controlled in part by<br />
\texttt{conf['activesync']['autodiscovery']} (name is historical; used beyond Autodiscover).

See README \textit{Protocol version configuration} for per-user permissions and the<br />
\texttt{activesync\_device\_version} hook.

\section{Debugging}
\begin{itemize}
\item Enable ActiveSync logging in Horde administration or \texttt{conf.php}<br />
(\texttt{logging.type = perdevice} writes one file per device id under the<br />
configured log path).


\item Reproduce with a single collection where possible.


\item Read README \textit{Request flow} and \textit{Client pairing lifecycle} to interpret<br />
\texttt{SyncKey}, \texttt{FolderSync}, and status codes.


\item Check <a href="https://wiki.horde.org/ActiveSync/BrokenClientBehavior">Broken Client Behavior</a> before<br />
assuming a server bug.


\end{itemize}
Deployment log paths and the author's test device id are documented in the<br />
deployment \texttt{AGENTS.md} / project rules -- not repeated here.

\section{Running tests}
From a Composer deployment root:

<pre><code class="language-bash">vendor/bin/phpunit -c vendor/horde/activesync/phpunit.xml.dist
</code></pre>
Calendar EAS tests: \texttt{vendor/horde/kronolith/test/Kronolith/Unit/EventActiveSyncTest.php}.<br />
See README for bootstrap details and integration fixtures under<br />
\texttt{vendor/horde/activesync/test/}.

\section{Contributing}
\begin{itemize}
\item Library changes: <a href="https://github.com/horde/activesync">horde/activesync</a> on branch \texttt{FRAMEWORK\_6\_0}


\item Horde driver / admin UI: <a href="https://github.com/horde/core">horde/core</a>, <a href="https://github.com/horde/horde">horde/horde</a>


\item App-specific mapping (calendar, contacts, tasks): respective app repos


\end{itemize}
Update \texttt{README.md} when adding commands, changing negotiation, or altering state<br />
shape. Add a short wiki note only when operators need new config or behaviour<br />
is client-visible.

Bug reports: <a href="http://bugs.horde.org/queue/sync">bugs.horde.org</a> -- include<br />
\texttt{MS-ASProtocolVersion}, \texttt{DeviceType}, \texttt{User-Agent}, and redacted per-device log<br />
excerpts.

\end{document}
