\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{Broken Client Behavior}
Horde.org wiki path: <a href="https://wiki.horde.org/ActiveSync/BrokenClientBehavior">ActiveSync/BrokenClientBehavior</a>

ActiveSync clients often violate <a href="https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-aswslp">MS-AS*</a> rules. Horde detects known patterns and compensates in \texttt{horde/activesync} so sync stays stable.

This page documents \textbf{server-side workarounds} in Horde 6 / ActiveSync 3.x. For symptoms and operator troubleshooting, see <a href="https://wiki.horde.org/ActiveSync/KnownIssues">Known Issues</a>. For setup and logging, see <a href="https://wiki.horde.org/ActiveSync">ActiveSync</a>.

Aligned with \texttt{vendor/horde/activesync} 3.0.0-RC (June 2026).

\section{Terminology: multiplex}
In Horde, \textbf{multiplex} means the server must merge several PIM sources (address books, calendars, task lists, notes folders) into \textbf{one} ActiveSync collection because the client cannot sync them separately.

\begin{itemize}
\item **Bitmask 0** -- native per-folder sync; Horde exposes each Turba book, Kronolith calendar, Nag list, and Mnemo folder as its own collection.


\item \textbf{Non-zero bitmask} -- Horde combines the flagged types into one collection.


\end{itemize}
Bitmask flags: contacts \textbf{1}, calendar \textbf{2}, tasks \textbf{4}, notes \textbf{8} (combinable, e.g. 13 = contacts + tasks + notes).

\textbf{iOS / iPadOS} use bitmask **0**: Mail, Calendars, Reminders, and Notes all support multiple server folders without server-side merging.

\section{Client detection}
\texttt{Horde\_ActiveSync\_Device} derives client type and OS version from \texttt{DeviceType}, \texttt{User-Agent}, and optional \texttt{Settings:OS} / \texttt{Settings:Model}. Third-party apps may not identify themselves reliably -- check per-device logs and the device record in Horde administration.

\section{Multiplex sniffing (Horde 6)}
Automatic rules in \texttt{\_sniffMultiplex()} -- **0** unless noted:

<table class="horde-table">Client & Bitmask & Notes \\
\hline
\textbf{iOS / iPadOS} & **0** & Full multi-folder support. Stale \texttt{MULTIPLEX\_NOTES} from old pairings is cleared on reconnect. \\
\hline
\textbf{Gmail} (\texttt{Android-Mail} UA) & **0** & Stock client on current Android (\texttt{Android-Mail/7.5+} tested). \\
\hline
\textbf{Nine}, \textbf{TouchDown} & **0** & Third-party Android clients with full folder support. \\
\hline
\textbf{Android stock} >= 4.4 & \textbf{13} (contacts + tasks + notes) & Per-calendar folders OK. \\
\hline
\textbf{Android stock} < 4.4 & \textbf{15} (all types) & Legacy. \\
\hline
\textbf{Samsung native}, \textbf{HTCOnemini2} & \textbf{15} & Sniffed by \texttt{deviceType} when OS version missing. \\
\hline
\textbf{Outlook} (\texttt{Outlook/15.0}, \texttt{Outlook/16.0} UA) & \textbf{1} (contacts) & Calendars and tasks per-folder. Other Outlook UA strings -> **0**. \\
\hline
\textbf{Unrecognized} & **0** & Assumes standards-compliant client. \\
\hline
</table>
Override: \textbf{Forced Multiplexed Bitmask} on the device record (disables auto-sniffing).

iOS Notes: protocol supports multiple collections; folder management is still easier from the Horde web UI than in the app.

\section{Horde 6 fixes that looked like client bugs}
<table class="horde-table">Symptom & Server-side fix \\
\hline
iOS mail Ping loops & PING watermark separate from IMAP SYNC \texttt{MODSEQ} \\
\hline
Endless \texttt{FOLDERSYNC\_REQUIRED} & Loop guard -- escalate after five ignored status-12 responses \\
\hline
Mysterious \texttt{KEYMISMATCH} & Corrupt \texttt{sync\_data} rejected/repaired on load and save \\
\hline
Stale iOS Notes multiplex flag & Cleared for iOS on device access \\
\hline
</table>
Defensive Ping/FolderSync ordering workarounds below remain for odd clients.

\section{Device quirks}
\texttt{Horde\_ActiveSync\_Device::hasQuirk()}:

<table class="horde-table">Quirk & Clients & Effect \\
\hline
\texttt{QUIRK\_NEEDS\_SUPPORTED\_PICTURE\_TAG} & iOS 4.x & Legacy -- ghost \texttt{Picture} when \texttt{SUPPORTED} absent \\
\hline
\texttt{QUIRK\_INCORRECTLY\_SENDS\_EMPTY\_PICTURE\_TAG} & iOS >= 8.2 & Ignore empty \texttt{Picture} on edit (photo wipe) \\
\hline
\texttt{QUIRK\_SUPPORTS\_TNEF} & Outlook & TNEF attachments passed through undecoded \\
\hline
</table>
\section{Ghosted fields}
Per MS-ASCMD: empty \texttt{SUPPORTED} -> all ghostable fields ghosted; missing \texttt{SUPPORTED} -> none ghosted. Horde special-cases contact \textbf{Picture} via quirks above. Calendar body/subject always ghost when omitted.

\section{Protocol workarounds}
\subsection{Autodiscover}
Broken \textbf{Android} auth: email as HTTP Basic username, no XML body -> Horde reads \texttt{PHP\_AUTH\_USER}, assumes 2006 mobilesync schemas. v2 JSON without \texttt{Protocol=} defaults to \texttt{ActiveSync}.

\subsection{Provisioning}
\textbf{Outlook 2013+} -- non-provisionable (no \texttt{ItemSettings}); connects under \textbf{Force} policy. \textbf{TestActiveSyncConnectivity} exempt. Old Android (EAS <= 1.2 UA) -- not enforced. \textbf{\texttt{PROVISIONING\_LOOSE}} -- allows broken handshakes.

\subsection{Ping}
Explicit folder lists before sync keys exist: ignore unknown collections or restore cached pingable set (iOS, Outlook).

\subsection{FolderSync / FolderCreate}
\textbf{BlackBerry} -- empty \texttt{ServerEntryId} accepted.

\subsection{Sync}
Missing sync key on \texttt{SyncCommands} -- ignored. Empty \texttt{ServerEntryId} on modify/remove -- accepted/skipped. \texttt{FOLDERSYNC\_REQUIRED} loop -- capped at five, then escalate.

\subsection{MeetingResponse}
\textbf{Outlook} -- wrong folder (calendar vs mailbox) -> retry \textbf{INBOX} once.

\subsection{MoveItems}
\textbf{Outlook 2013} -- suppress duplicate ADD after move.

\subsection{Contacts: birthdays}
\texttt{normalizePoomContactsDates()} per client: iOS >= 5 midnight UTC; Android stock \texttt{08:00 UTC}; Samsung/Gmail midnight UTC; BlackBerry \texttt{11:00 UTC}.

\subsection{Attachments}
Malformed AirSyncBase \textbf{FileReference} / \textbf{Location} elements filtered before backends.

\section{Modern clients summary}
<table class="horde-table">Client & Special casing \\
\hline
\textbf{iOS 16.x} & None for multiplex; EAS 16.0/16.1, instance calendar, Find, propose-new-time when negotiated \\
\hline
\textbf{Gmail / Android-Mail} & None for multiplex \\
\hline
\textbf{Outlook desktop} & Contacts bitmask 1 if UA matches; TNEF; provisioning exempt \\
\hline
\textbf{Samsung Exchange} & Full multiplex bitmask 15 \\
\hline
</table>
Open issues on modern iOS (truncated calendar bodies, task recurrence) -> <a href="https://wiki.horde.org/ActiveSync/KnownIssues">Known Issues</a>.

\section{Legacy (archive only)}
Windows Phone 8.x, PocketPC, Android < 4.4, iOS 4.x -- sniffing rules kept for old device records; not tested on Horde 6.

\section{Not worked around}
Persistent \texttt{KEYMISMATCH} ignore, SMS stub, Outlook \texttt{Regenerate=1}, truncated calendar overwrite on iOS.

\section{Reporting bugs}
Per-device log + \texttt{MS-ASProtocolVersion} + \texttt{DeviceType} + \texttt{User-Agent} + multiplex bitmask -> <a href="http://bugs.horde.org/queue/sync">bugs.horde.org</a> (redacted).

\end{document}
