Skip to content

Support for Capability items to be 'dynamic'#181

Open
shaun-a-johnson wants to merge 4 commits intodovecot:mainfrom
linuxmagic:dynamic-capabilities
Open

Support for Capability items to be 'dynamic'#181
shaun-a-johnson wants to merge 4 commits intodovecot:mainfrom
linuxmagic:dynamic-capabilities

Conversation

@shaun-a-johnson
Copy link
Copy Markdown
Contributor

This patch converts the previous string-literal representation of the capabilities to a dynamic list of 'capability objects' each reflecting the capability word they intend to add along with flags that represent when the capability word is to be displayed (eg: varying states).

Upon a request for the capability string the list of capability objects is iterated and a capability string is dynamically built by appending each capability word if the conditions described in the flags of the capability object are met.

This patch provides full backwards compatibility for existing plugins that might have previously used client_add_capability as well as honors (and converts) existing string literal capability words into equivalent additions to the new list of capability objects.

Some examples of circumstances that can be specified when adding
new capabilities are:

  • Only show at pre-login or post-login
  • Only show if any TLS/SSL is active/inactive
  • Only show if plaintext auth login is enabled

The default operation is to show the capabaility word if at least
one of the circumstances is met, an additional flag provides the
ability to only show the capability word if exactly all of the
circumstances are met.

The API for adding capabilities now simply wraps the API for adding
entries to the capability list with the 'show always' flag set.

Retrieving the capability string is now a loop that iterates the list
of capability objects and evaluates whether each capability should be
added to the capability string based on the state of the current IMAP
session.

Loading
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