Skip to content

Add IMAP quota command#460

Open
Mullayam wants to merge 2 commits intoProtonMail:devfrom
enjoys-in:imap-quota
Open

Add IMAP quota command#460
Mullayam wants to merge 2 commits intoProtonMail:devfrom
enjoys-in:imap-quota

Conversation

@Mullayam
Copy link

This pull request adds IMAP QUOTA support to the codebase, enabling the server to handle quota-related commands and responses as specified by RFC 2087. It introduces new command parsing, connector interface methods, session handlers, and response types to support GETQUOTA and GETQUOTAROOT commands, as well as error handling for over-quota situations. The changes also extend the IMAP capabilities advertised by the server to include QUOTA.

IMAP QUOTA Support

  • Added new IMAP commands and parsers for GETQUOTA and GETQUOTAROOT, enabling clients to query quota information. (imap/command/getquota.go [1] imap/command/getquotaroot.go [2] imap/command/parser.go [3]
  • Introduced new types to represent quota roots and resources. (imap/quota.go imap/quota.goR1-R14)
  • Extended the Connector interface with GetQuota and GetQuotaRoot methods, and implemented them in the dummy and mock connectors for testing. (connector/connector.go [1] [2] connector/dummy.go [3] [4] [5] connector/mock_connector/connector.go [6]
  • Updated the session to handle GETQUOTA and GETQUOTAROOT commands, including new handler files and response types for quota and quota root information. (internal/session/handle.go [1] [2] internal/session/handle_getquota.go [3] internal/session/handle_getquotaroot.go [4] internal/response/quota.go [5] internal/response/quotaroot.go [6]

Over-Quota Error Handling

  • Added a new ErrOverQuota error and ensured that append, copy, and move operations return the appropriate IMAP response when the quota is exceeded. (connector/connector.go [1] internal/session/handle_append.go [2] [3] internal/session/handle_copy.go [4] [5] internal/session/handle_move.go [6] [7] internal/response/item_overquota.go [8]
  • Updated session error handling logic to suppress reporting of over-quota errors as unexpected. (internal/session/errors.go internal/session/errors.goR35-R36)

IMAP Capabilities

  • Advertised the QUOTA capability to clients and updated capability checks to support pre-auth and post-auth logic. (imap/capabilities.go [1] internal/session/session.go [2]

Backend and State Integration

These changes collectively enable full IMAP QUOTA support, including command parsing, backend integration, error handling, and client communication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant