feat(core): reconnect IMAP for ActiveSync mail via mail API#196
Merged
Conversation
ActiveSync authenticates to Horde but, on hordeauth backends, the mail app may have no established IMAP login on stateless or long-running (PING) requests. mail->imapOb() then returns an empty client and the sync layer fails. On ActiveSync authentication, and lazily in the IMAP factory when the client is empty, trigger the mail app's IMAP login via the optional mail/ensureImapConnection API method (added in horde/imp #89). Guarded with Registry::hasMethod(), so Core stays agnostic of the concrete mail app and no-ops when the method is unavailable. The factory also throws a clear exception instead of returning an empty client.
ralflang
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mail/ensureImapConnectionAPI method.Horde_ActiveSync_Exceptioninstead of returning an empty client.Motivation
ActiveSync authenticates to Horde, but with
hordeauthmail backends the mail app may not have an established IMAP login on stateless or long-running (PING) requests.$registry->mail->imapOb()then returns an empty client, andHorde_ActiveSync_Imap_Adapterends up callingstatus()onnull(see horde/ActiveSync#78).Changes
Horde_Core_ActiveSync_Driver::authenticate(): after successful Horde auth, call_ensureMailAuthenticated(), which triggers$registry->mail->ensureImapConnection([...])when email sync is enabled.Horde_Core_ActiveSync_Imap_Factory::getImapOb(): ifimapOb()yields an empty client, callensureImapConnection()and retry; throw a clear exception if still unavailable.Registry::hasMethod('mail/ensureImapConnection'), so Core remains agnostic of the concrete mail app and no-ops when the capability is absent.Dependencies
mail/ensureImapConnectionAPI method added in horde/imp feat: OAuthTokenService scope-aware token retrieval #89.Notes
Test plan
status() on null.