]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: remove unused internal_attribute argument from attribute_{get,set}
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Tue, 20 Sep 2016 12:51:29 +0000 (08:51 -0400)
committerJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Tue, 20 Sep 2016 12:51:29 +0000 (08:51 -0400)
This removes an argument added in 9f37ef2a9192e7d47e3d7ac959080fd01120f2e9
but obsoleted (but not removed) in d1147c225f64596fc5eeb1cb2aab31b3c57d5215.

Not only does this change simplify the codebase, it actually brings the API
closer to what it was back in 2.2.

src/lib-storage/index/index-attribute.c
src/lib-storage/index/index-storage.h
src/lib-storage/mail-storage-private.h
src/lib-storage/mailbox-attribute-internal.c
src/lib-storage/mailbox-attribute.c
src/lib-storage/mailbox-attribute.h
src/plugins/acl/acl-attributes.c
src/plugins/acl/acl-storage.h

index 0f03e2411ef9294108e1a224c65134c53f4591d2..f7f65864118198819d25bf71e9724a500f63ec35 100644 (file)
@@ -191,8 +191,7 @@ index_storage_attribute_get_dict_trans(struct mailbox_transaction_context *t,
 
 int index_storage_attribute_set(struct mailbox_transaction_context *t,
                                enum mail_attribute_type type, const char *key,
-                               const struct mail_attribute_value *value,
-                               bool unused ATTR_UNUSED)
+                               const struct mail_attribute_value *value)
 {
        struct dict_transaction_context *dtrans;
        const char *mailbox_prefix;
@@ -226,8 +225,7 @@ int index_storage_attribute_set(struct mailbox_transaction_context *t,
 
 int index_storage_attribute_get(struct mailbox *box,
                                enum mail_attribute_type type, const char *key,
-                               struct mail_attribute_value *value_r,
-                               bool unused ATTR_UNUSED)
+                               struct mail_attribute_value *value_r)
 {
        struct dict *dict;
        const char *mailbox_prefix, *error;
index 0d8388fc51a6256ba5ab0ef7e19e02ed3135cec9..62d106b3a211df6d7f1a49e861f0e6a5f32788f8 100644 (file)
@@ -113,12 +113,10 @@ int index_mailbox_get_physical_size(struct mailbox *box,
 
 int index_storage_attribute_set(struct mailbox_transaction_context *t,
                                enum mail_attribute_type type, const char *key,
-                               const struct mail_attribute_value *value,
-                               bool unused);
+                               const struct mail_attribute_value *value);
 int index_storage_attribute_get(struct mailbox *box,
                                enum mail_attribute_type type, const char *key,
-                               struct mail_attribute_value *value_r,
-                               bool unused);
+                               struct mail_attribute_value *value_r);
 struct mailbox_attribute_iter *
 index_storage_attribute_iter_init(struct mailbox *box,
                                  enum mail_attribute_type type,
index daf0a6031cc0276d3743c870c6334760d619551e..bcf4c19a327271d2d24a70a3ba291afa61aa55cd 100644 (file)
@@ -194,12 +194,10 @@ struct mailbox_vfuncs {
 
        int (*attribute_set)(struct mailbox_transaction_context *t,
                             enum mail_attribute_type type, const char *key,
-                            const struct mail_attribute_value *value,
-                            bool internal_attribute);
+                            const struct mail_attribute_value *value);
        int (*attribute_get)(struct mailbox *box,
                             enum mail_attribute_type type, const char *key,
-                            struct mail_attribute_value *value_r,
-                            bool internal_attribute);
+                            struct mail_attribute_value *value_r);
        struct mailbox_attribute_iter *
                (*attribute_iter_init)(struct mailbox *box,
                                       enum mail_attribute_type type,
index a9bc788e85897c18ca179bbfda812d5009a61bd2..f9a75afc35351343fc88c06a3d1b9354c8703216 100644 (file)
@@ -13,8 +13,7 @@
 static int
 mailbox_attribute_specialuse_get(struct mailbox *box,
        const char *key ATTR_UNUSED,
-       struct mail_attribute_value *value_r,
-       bool internal_attribute ATTR_UNUSED)
+       struct mail_attribute_value *value_r)
 {
        const struct mailbox_settings *set = box->set;
 
@@ -39,8 +38,7 @@ iattr_mbox_prv_special_use = {
 static int
 mailbox_attribute_comment_get(struct mailbox *box,
        const char *key ATTR_UNUSED,
-       struct mail_attribute_value *value_r,
-       bool internal_attribute ATTR_UNUSED)
+       struct mail_attribute_value *value_r)
 {
        const struct mailbox_settings *set = box->set;
 
@@ -77,8 +75,7 @@ iattr_mbox_shd_comment = {
 static int
 server_attribute_comment_get(struct mailbox *box,
        const char *key ATTR_UNUSED,
-       struct mail_attribute_value *value_r,
-       bool internal_attribute ATTR_UNUSED)
+       struct mail_attribute_value *value_r)
 {
        const struct mail_storage_settings *set = box->storage->set;
 
@@ -103,8 +100,7 @@ iattr_serv_shd_comment = {
 static int
 server_attribute_admin_get(struct mailbox *box,
        const char *key ATTR_UNUSED,
-       struct mail_attribute_value *value_r,
-       bool internal_attribute ATTR_UNUSED)
+       struct mail_attribute_value *value_r)
 {
        const struct mail_storage_settings *set = box->storage->set;
 
index 1249eb10ae830013fd7423f1f2c95a198e48bdd3..6d8e14d22f78b011868546a14511a8e116b308fb 100644 (file)
@@ -174,7 +174,7 @@ mailbox_attribute_set_common(struct mailbox_transaction_context *t,
                case MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT:
                case MAIL_ATTRIBUTE_INTERNAL_RANK_OVERRIDE:
                        /* notify about assignment */
-                       if (iattr->set != NULL && iattr->set(t, key, value, TRUE) < 0)
+                       if (iattr->set != NULL && iattr->set(t, key, value) < 0)
                                return -1;
                        break;
                case MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY:
@@ -185,13 +185,13 @@ mailbox_attribute_set_common(struct mailbox_transaction_context *t,
                                return -1;
                        }
                        /* assign internal attribute */
-                       return iattr->set(t, key, value, TRUE);
+                       return iattr->set(t, key, value);
                default:
                        i_unreached();
                }
        }
-       
-       ret = t->box->v.attribute_set(t, type, key, value, (iattr != NULL && iattr->rank != MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY));
+
+       ret = t->box->v.attribute_set(t, type, key, value);
        return ret;
 }
 
@@ -265,16 +265,17 @@ mailbox_attribute_get_common(struct mailbox *box,
        if (iattr != NULL) {
                switch (iattr->rank) {
                case MAIL_ATTRIBUTE_INTERNAL_RANK_OVERRIDE:
-                       if ((ret = iattr->get(box, key, value_r, TRUE)) != 0) {
+                       if ((ret = iattr->get(box, key, value_r)) != 0) {
                                if (ret < 0)
                                        return -1;
                                value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY;
                                return 1;
                        }
+                       break;
                case MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT:
                        break;
                case MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY:
-                       if ((ret = iattr->get(box, key, value_r, TRUE)) <= 0)
+                       if ((ret = iattr->get(box, key, value_r)) <= 0)
                                return ret;
                        value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY;
                        return 1;
@@ -283,9 +284,7 @@ mailbox_attribute_get_common(struct mailbox *box,
                }
        }
 
-       bool internal_attribute = (iattr != NULL && iattr->rank != MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY);
-
-       ret = box->v.attribute_get(box, type, key, value_r, internal_attribute);
+       ret = box->v.attribute_get(box, type, key, value_r);
        if (ret != 0)
                return ret;
 
@@ -296,13 +295,14 @@ mailbox_attribute_get_common(struct mailbox *box,
                        if (iattr->get == NULL)
                                ret = 0;
                        else {
-                               if ((ret = iattr->get(box, key, value_r, internal_attribute)) < 0)
+                               if ((ret = iattr->get(box, key, value_r)) < 0)
                                        return ret;
                        }
                        if (ret > 0) {
                                value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY;
                                return 1;
                        }
+                       break;
                case MAIL_ATTRIBUTE_INTERNAL_RANK_OVERRIDE:
                        break;
                default:
index 413dac634b1d70e1b7c2edc2d72bda5f80f828d6..d7e8348867a633a2cb13643ef6311ecc5787871c 100644 (file)
@@ -245,10 +245,10 @@ struct mailbox_attribute_internal {
 
        /* Get the value of this internal attribute */
        int (*get)(struct mailbox *box, const char *key,
-                  struct mail_attribute_value *value_r, bool internal_attribute);
-       /* Set the value of this internal attribute */ 
+                  struct mail_attribute_value *value_r);
+       /* Set the value of this internal attribute */
        int (*set)(struct mailbox_transaction_context *t, const char *key,
-                  const struct mail_attribute_value *value, bool internal_attribute);
+                  const struct mail_attribute_value *value);
 };
 
 void mailbox_attribute_register_internal(
index 7864975f219d3dda65587efa661ec45c0f8e4300..d8aa13f0944936bba5912168d6af4bae63a6e7e1 100644 (file)
@@ -136,8 +136,7 @@ static int acl_have_attribute_rights(struct mailbox *box)
 
 int acl_attribute_set(struct mailbox_transaction_context *t,
                      enum mail_attribute_type type, const char *key,
-                     const struct mail_attribute_value *value,
-                     bool internal_attribute)
+                     const struct mail_attribute_value *value)
 {
        struct acl_mailbox *abox = ACL_CONTEXT(t->box);
 
@@ -146,13 +145,12 @@ int acl_attribute_set(struct mailbox_transaction_context *t,
        if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_ACL,
                    strlen(MAILBOX_ATTRIBUTE_PREFIX_ACL)) == 0)
                return acl_attribute_update_acl(t, key, value);
-       return abox->module_ctx.super.attribute_set(t, type, key, value, internal_attribute);
+       return abox->module_ctx.super.attribute_set(t, type, key, value);
 }
 
 int acl_attribute_get(struct mailbox *box,
                      enum mail_attribute_type type, const char *key,
-                     struct mail_attribute_value *value_r,
-                     bool internal_attribute)
+                     struct mail_attribute_value *value_r)
 {
        struct acl_mailbox *abox = ACL_CONTEXT(box);
 
@@ -161,7 +159,7 @@ int acl_attribute_get(struct mailbox *box,
        if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_ACL,
                    strlen(MAILBOX_ATTRIBUTE_PREFIX_ACL)) == 0)
                return acl_attribute_get_acl(box, key, value_r);
-       return abox->module_ctx.super.attribute_get(box, type, key, value_r, internal_attribute);
+       return abox->module_ctx.super.attribute_get(box, type, key, value_r);
 }
 
 struct mailbox_attribute_iter *
index 75fccb0de3cd7e6b4fdd1c3a3424b84eda2cfa76..5f7df621720d29e4bd21be30eae18587eb3ef51a 100644 (file)
@@ -33,12 +33,10 @@ int acl_mailbox_update_acl(struct mailbox_transaction_context *t,
 
 int acl_attribute_set(struct mailbox_transaction_context *t,
                      enum mail_attribute_type type, const char *key,
-                     const struct mail_attribute_value *value,
-                     bool internal_attribute);
+                     const struct mail_attribute_value *value);
 int acl_attribute_get(struct mailbox *box,
                      enum mail_attribute_type type, const char *key,
-                     struct mail_attribute_value *value_r,
-                     bool internal_attribute);
+                     struct mail_attribute_value *value_r);
 struct mailbox_attribute_iter *
 acl_attribute_iter_init(struct mailbox *box, enum mail_attribute_type type,
                        const char *prefix);