changeset 19104:04ed3c9c330f

lib-storage: Allow MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT to use get=NULL This is useful for registering internal attributes whose only purpose is to be able to set/get them via dict. (Because normally the dict access would be denied completely.)
author Timo Sirainen <tss@iki.fi>
date Mon, 07 Sep 2015 16:23:40 +0300
parents 5d3c7d882bfb
children 2e420ceaee1d
files src/lib-storage/mailbox-attribute.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mailbox-attribute.c	Mon Sep 07 16:22:11 2015 +0300
+++ b/src/lib-storage/mailbox-attribute.c	Mon Sep 07 16:23:40 2015 +0300
@@ -282,8 +282,12 @@
 	if (iattr != NULL) {
 		switch (iattr->rank) {
 		case MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT:		
-			if ((ret = iattr->get(t, key, value_r)) < 0)
-				return ret;
+			if (iattr->get == NULL)
+				ret = 0;
+			else {
+				if ((ret = iattr->get(t, key, value_r)) < 0)
+					return ret;
+			}
 			if (ret > 0) {
 				value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY;
 				return 1;