dovecot-2.2: lib-storage: Added mailbox_status.have_save_guids.

dovecot at dovecot.org dovecot at dovecot.org
Mon May 20 00:09:18 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/35871cb142df
changeset: 16373:35871cb142df
user:      Timo Sirainen <tss at iki.fi>
date:      Sun May 19 23:42:29 2013 +0300
description:
lib-storage: Added mailbox_status.have_save_guids.

diffstat:

 src/lib-storage/index/dbox-multi/mdbox-storage.c  |  3 ++-
 src/lib-storage/index/dbox-single/sdbox-storage.c |  3 ++-
 src/lib-storage/index/maildir/maildir-storage.c   |  3 ++-
 src/lib-storage/mail-storage-private.h            |  5 ++++-
 src/lib-storage/mail-storage.c                    |  7 ++++++-
 src/lib-storage/mail-storage.h                    |  2 ++
 src/plugins/virtual/virtual-storage.c             |  5 +++++
 src/plugins/virtual/virtual-storage.h             |  1 +
 8 files changed, 24 insertions(+), 5 deletions(-)

diffs (130 lines):

diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/index/dbox-multi/mdbox-storage.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage.c	Sun May 19 23:21:20 2013 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c	Sun May 19 23:42:29 2013 +0300
@@ -410,7 +410,8 @@
 struct mail_storage mdbox_storage = {
 	.name = MDBOX_STORAGE_NAME,
 	.class_flags = MAIL_STORAGE_CLASS_FLAG_UNIQUE_ROOT |
-		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS,
+		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS |
+		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS,
 
 	.v = {
                 mdbox_get_setting_parser_info,
diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/index/dbox-single/sdbox-storage.c
--- a/src/lib-storage/index/dbox-single/sdbox-storage.c	Sun May 19 23:21:20 2013 +0300
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.c	Sun May 19 23:42:29 2013 +0300
@@ -390,7 +390,8 @@
 struct mail_storage sdbox_storage = {
 	.name = SDBOX_STORAGE_NAME,
 	.class_flags = MAIL_STORAGE_CLASS_FLAG_FILE_PER_MSG |
-		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS,
+		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS |
+		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS,
 
 	.v = {
                 NULL,
diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c	Sun May 19 23:21:20 2013 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Sun May 19 23:42:29 2013 +0300
@@ -657,7 +657,8 @@
 struct mail_storage maildir_storage = {
 	.name = MAILDIR_STORAGE_NAME,
 	.class_flags = MAIL_STORAGE_CLASS_FLAG_FILE_PER_MSG |
-		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS,
+		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS |
+		MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS,
 
 	.v = {
                 maildir_get_setting_parser_info,
diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Sun May 19 23:21:20 2013 +0300
+++ b/src/lib-storage/mail-storage-private.h	Sun May 19 23:42:29 2013 +0300
@@ -66,7 +66,10 @@
 	/* Storage uses one file per message */
 	MAIL_STORAGE_CLASS_FLAG_FILE_PER_MSG	= 0x20,
 	/* Messages have GUIDs (always set mailbox_status.have_guids=TRUE) */
-	MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS	= 0x40
+	MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS	= 0x40,
+	/* mailbox_save_set_guid() works (always set
+	   mailbox_status.have_save_guids=TRUE) */
+	MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS	= 0x80
 };
 
 struct mail_binary_cache {
diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Sun May 19 23:21:20 2013 +0300
+++ b/src/lib-storage/mail-storage.c	Sun May 19 23:42:29 2013 +0300
@@ -1471,6 +1471,8 @@
 	memset(status_r, 0, sizeof(*status_r));
 	if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS) != 0)
 		status_r->have_guids = TRUE;
+	if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS) != 0)
+		status_r->have_save_guids = TRUE;
 }
 
 int mailbox_get_status(struct mailbox *box,
@@ -1480,7 +1482,10 @@
 	mailbox_get_status_set_defaults(box, status_r);
 	if (mailbox_verify_existing_name(box) < 0)
 		return -1;
-	return box->v.get_status(box, items, status_r);
+	if (box->v.get_status(box, items, status_r) < 0)
+		return -1;
+	i_assert(status_r->have_guids || !status_r->have_save_guids);
+	return 0;
 }
 
 void mailbox_get_open_status(struct mailbox *box,
diff -r bfca9879f7b6 -r 35871cb142df src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Sun May 19 23:21:20 2013 +0300
+++ b/src/lib-storage/mail-storage.h	Sun May 19 23:42:29 2013 +0300
@@ -275,6 +275,8 @@
 
 	/* Messages have GUIDs (always set) */
 	unsigned int have_guids:1;
+	/* mailbox_save_set_guid() works (always set) */
+	unsigned int have_save_guids:1;
 };
 
 struct mailbox_cache_field {
diff -r bfca9879f7b6 -r 35871cb142df src/plugins/virtual/virtual-storage.c
--- a/src/plugins/virtual/virtual-storage.c	Sun May 19 23:21:20 2013 +0300
+++ b/src/plugins/virtual/virtual-storage.c	Sun May 19 23:42:29 2013 +0300
@@ -182,6 +182,8 @@
 	mailbox_get_open_status(bbox->box, 0, &status);
 	if (!status.have_guids)
 		mbox->have_guids = FALSE;
+	if (!status.have_save_guids)
+		mbox->have_save_guids = FALSE;
 	return 1;
 }
 
@@ -193,6 +195,7 @@
 	int ret;
 
 	mbox->have_guids = TRUE;
+	mbox->have_save_guids = TRUE;
 
 	bboxes = array_get(&mbox->backend_boxes, &count);
 	for (i = 0; i < count; ) {
@@ -365,6 +368,8 @@
 	}
 	if (mbox->have_guids)
 		status_r->have_guids = TRUE;
+	if (mbox->have_save_guids)
+		status_r->have_save_guids = TRUE;
 	return 0;
 }
 
diff -r bfca9879f7b6 -r 35871cb142df src/plugins/virtual/virtual-storage.h
--- a/src/plugins/virtual/virtual-storage.h	Sun May 19 23:21:20 2013 +0300
+++ b/src/plugins/virtual/virtual-storage.h	Sun May 19 23:42:29 2013 +0300
@@ -145,6 +145,7 @@
 	unsigned int sync_initialized:1;
 	unsigned int inconsistent:1;
 	unsigned int have_guids:1;
+	unsigned int have_save_guids:1;
 };
 
 extern MODULE_CONTEXT_DEFINE(virtual_storage_module,


More information about the dovecot-cvs mailing list