]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Add client_enabled_features()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 29 Nov 2018 08:01:36 +0000 (10:01 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 6 Feb 2019 08:09:12 +0000 (10:09 +0200)
This simplifies the following commits.

src/imap/imap-client.c
src/imap/imap-client.h

index eb2829d9f78baaf1a9e8bba536a1bc52e7de3497..4931160350deb9428fb984546ed821ab3525d05d 100644 (file)
@@ -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)
index d8ed67734fe5f1df6726cf81320e4c36b9354bff..d391587029a94e73edb50122ee657ad9c78a01ed 100644 (file)
@@ -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. */