Skip to content

feat(core): reconnect IMAP for ActiveSync mail via mail API#196

Merged
ralflang merged 1 commit into
FRAMEWORK_6_0from
fix/activesync-mail-imap-reconnect
Jul 8, 2026
Merged

feat(core): reconnect IMAP for ActiveSync mail via mail API#196
ralflang merged 1 commit into
FRAMEWORK_6_0from
fix/activesync-mail-imap-reconnect

Conversation

@TDannhauer

Copy link
Copy Markdown
Contributor

Summary

  • On ActiveSync auth and lazily in the IMAP factory, ensure the mail app has a live IMAP connection via the optional mail/ensureImapConnection API method.
  • The IMAP factory now throws a clear Horde_ActiveSync_Exception instead of returning an empty client.

Motivation

ActiveSync authenticates to Horde, but with hordeauth mail 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, and Horde_ActiveSync_Imap_Adapter ends up calling status() on null (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(): if imapOb() yields an empty client, call ensureImapConnection() and retry; throw a clear exception if still unavailable.
  • Both call sites are guarded by Registry::hasMethod('mail/ensureImapConnection'), so Core remains agnostic of the concrete mail app and no-ops when the capability is absent.

Dependencies

Notes

Test plan

  • EAS device with mail sync on a hordeauth backend; confirm mail folders sync after idle/PING without status() on null.
  • Install without the mail method: confirm ActiveSync auth still succeeds (no-op).

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.
@TDannhauer TDannhauer requested a review from ralflang July 8, 2026 18:25
@ralflang ralflang merged commit c27a6e9 into FRAMEWORK_6_0 Jul 8, 2026
1 check failed
@TDannhauer TDannhauer deleted the fix/activesync-mail-imap-reconnect branch July 10, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants