dovecot-2.2: imap: Implemented /private/specialuse METADATA entr...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 7 22:31:29 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/c4932f3f4acd
changeset: 19125:c4932f3f4acd
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sat Apr 25 11:42:06 2015 +0200
description:
imap: Implemented /private/specialuse METADATA entry for SPECIAL-USE capability.

diffstat:

 src/lib-storage/Makefile.am                  |   2 +
 src/lib-storage/mailbox-attribute-internal.c |  48 ++++++++++++++++++++++++++++
 src/lib-storage/mailbox-attribute-internal.h |   9 +++++
 src/lib-storage/mailbox-attribute.c          |   4 ++
 4 files changed, 63 insertions(+), 0 deletions(-)

diffs (105 lines):

diff -r d85bf97ab8b7 -r c4932f3f4acd src/lib-storage/Makefile.am
--- a/src/lib-storage/Makefile.am	Tue Sep 08 01:27:18 2015 +0300
+++ b/src/lib-storage/Makefile.am	Sat Apr 25 11:42:06 2015 +0200
@@ -45,6 +45,7 @@
 	mail-thread.c \
 	mail-user.c \
 	mailbox-attribute.c \
+	mailbox-attribute-internal.c \
 	mailbox-get.c \
 	mailbox-guid-cache.c \
 	mailbox-header.c \
@@ -75,6 +76,7 @@
 	mail-storage-settings.h \
 	mail-user.h \
 	mailbox-attribute.h \
+	mailbox-attribute-internal.h \
 	mailbox-attribute-private.h \
 	mailbox-guid-cache.h \
 	mailbox-list.h \
diff -r d85bf97ab8b7 -r c4932f3f4acd src/lib-storage/mailbox-attribute-internal.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib-storage/mailbox-attribute-internal.c	Sat Apr 25 11:42:06 2015 +0200
@@ -0,0 +1,48 @@
+/* Copyright (c) 2003-2015 Dovecot authors, see the included COPYING file */
+
+#include "lib.h"
+#include "mail-storage-private.h"
+#include "mailbox-attribute-internal.h"
+
+/*
+ * Internal mailbox attributes
+ */
+
+ /* /private/specialuse (RFC 6154) */
+
+static int
+mailbox_attribute_specialuse_get(struct mailbox_transaction_context *t,
+  const char *key ATTR_UNUSED,
+	struct mail_attribute_value *value_r)
+{
+	const struct mailbox_settings *set = t->box->set;
+
+	if (set == NULL || *set->special_use == '\0')
+		return 0;
+
+	value_r->value = set->special_use;
+	return 1;
+}
+
+static struct mailbox_attribute_internal
+iattr_mbox_prv_special_use = {
+	.type = MAIL_ATTRIBUTE_TYPE_PRIVATE,
+	.key = MAILBOX_ATTRIBUTE_SPECIALUSE,
+	.rank = MAIL_ATTRIBUTE_INTERNAL_RANK_AUTHORITY,
+
+	.get = mailbox_attribute_specialuse_get
+};
+
+/*
+ * Registry
+ */
+
+void mailbox_attributes_internal_init(void)
+{
+	/*
+	 * Internal mailbox attributes
+	 */
+
+	/* /private/specialuse (RFC 6154) */
+	mailbox_attribute_register_internal(&iattr_mbox_prv_special_use);
+}
diff -r d85bf97ab8b7 -r c4932f3f4acd src/lib-storage/mailbox-attribute-internal.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib-storage/mailbox-attribute-internal.h	Sat Apr 25 11:42:06 2015 +0200
@@ -0,0 +1,9 @@
+#ifndef MAILBOX_ATTRIBUTE_INTERNAL_H
+#define MAILBOX_ATTRIBUTE_INTERNAL_H
+
+/* RFC 6154, Section 4: IMAP METADATA Entry for Special-Use Attributes */
+#define MAILBOX_ATTRIBUTE_SPECIALUSE "specialuse"
+
+void mailbox_attributes_internal_init(void);
+
+#endif
diff -r d85bf97ab8b7 -r c4932f3f4acd src/lib-storage/mailbox-attribute.c
--- a/src/lib-storage/mailbox-attribute.c	Tue Sep 08 01:27:18 2015 +0300
+++ b/src/lib-storage/mailbox-attribute.c	Sat Apr 25 11:42:06 2015 +0200
@@ -6,6 +6,7 @@
 #include "istream.h"
 #include "mail-storage-private.h"
 #include "bsearch-insert-pos.h"
+#include "mailbox-attribute-internal.h"
 
 static ARRAY(struct mailbox_attribute_internal) mailbox_internal_attributes;
 static pool_t mailbox_attribute_pool;
@@ -15,6 +16,9 @@
 	mailbox_attribute_pool =
 		pool_alloconly_create("mailbox attributes", 2048);
 	i_array_init(&mailbox_internal_attributes, 32);
+
+	/* internal mailbox attributes */
+	mailbox_attributes_internal_init();
 }
 
 void mailbox_attributes_deinit(void)


More information about the dovecot-cvs mailing list