Skip to content

JMAP Protocol Abstraction and Routing Infrastructure #12609

@ChristophWurst

Description

@ChristophWurst

Summary

Introduce a protocol abstraction layer that enables the service layer to route operations to
either IMAP or JMAP client factories based on the account's configured protocol.

Problem

The service layer is currently tightly coupled to IMAP. To support multiple protocols,
the codebase needs a way to route client instantiation and key operations based on account configuration.

Solution

  • Add protocol_type column to mail_accounts table (default: 'imap' for existing accounts)
  • Create ProtocolClientFactory dispatcher
  • Refactor existing code to use dispatcher for client instantiation
  • Update account creation API to accept protocol parameter
  • Ensure existing IMAP accounts continue working

Implementation

Database migration adds protocol_type enum column ('imap' | 'jmap', default: 'imap').

Services query account protocol before instantiating clients:

$client = $this->protocolClientFactory->getClient($account);

The dispatcher checks $account->getProtocol() and returns the appropriate client factory.

Account API endpoint accepts optional protocol parameter (defaults to 'imap').

Affected Components

  • Database: migration for mail_accounts table
  • MailAccount entity: add protocol field
  • MailManager, SyncService: use dispatcher
  • AccountsController: accept protocol parameter
  • New: ProtocolClientFactory dispatcher

Out of Scope

  • Authentication method selection (OAuth, etc.)
  • Protocol auto-detection

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions