Skip to content

Commit

Permalink
imap: Add client_enabled_features()
Browse files Browse the repository at this point in the history
This simplifies the following commits.
  • Loading branch information
sirainen authored and villesavolainen committed Feb 6, 2019
1 parent c3538af commit 1631bb3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/imap/imap-client.c
Expand Up @@ -1495,6 +1495,21 @@ enum mailbox_feature client_enabled_mailbox_features(struct client *client)
return client->enabled_features;
}

const char *const *client_enabled_features(struct client *client)
{
static const char *condstore_str = "CONDSTORE";
static const char *qresync_str = "QRESYNC";
ARRAY_TYPE(const_string) features;
t_array_init(&features, 8);

if ((client->enabled_features & imap_feature_condstore) != 0)
array_append(&features, &condstore_str, 1);
if ((client->enabled_features & imap_feature_qresync) != 0)
array_append(&features, &qresync_str, 1);
array_append_zero(&features);
return array_idx(&features, 0);
}

struct imap_search_update *
client_search_update_lookup(struct client *client, const char *tag,
unsigned int *idx_r)
Expand Down
2 changes: 2 additions & 0 deletions src/imap/imap-client.h
Expand Up @@ -310,6 +310,8 @@ void client_enable(struct client *client, unsigned int feature_idx);
bool client_has_enabled(struct client *client, unsigned int feature_idx);
/* Returns mailbox features that are currently enabled. */
enum mailbox_feature client_enabled_mailbox_features(struct client *client);
/* Returns all enabled features as strings. */
const char *const *client_enabled_features(struct client *client);

/* Send client processing to imap-idle process. If successful, returns TRUE
and destroys the client. */
Expand Down

0 comments on commit 1631bb3

Please sign in to comment.