dovecot-2.0: Added mailbox_keywords_create_from_indexes().

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 5 03:20:54 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/374d29a1905e
changeset: 9455:374d29a1905e
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 04 20:13:40 2009 -0400
description:
Added mailbox_keywords_create_from_indexes().

diffstat:

10 files changed, 34 insertions(+), 2 deletions(-)
src/lib-storage/index/cydir/cydir-storage.c     |    1 +
src/lib-storage/index/dbox/dbox-storage.c       |    1 +
src/lib-storage/index/index-storage.c           |    9 +++++++++
src/lib-storage/index/index-storage.h           |    3 +++
src/lib-storage/index/maildir/maildir-storage.c |    1 +
src/lib-storage/index/mbox/mbox-storage.c       |    1 +
src/lib-storage/index/raw/raw-storage.c         |    1 +
src/lib-storage/mail-storage-private.h          |    3 +++
src/lib-storage/mail-storage.c                  |   13 +++++++++++--
src/lib-storage/mail-storage.h                  |    3 +++

diffs (150 lines):

diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/index/cydir/cydir-storage.c
--- a/src/lib-storage/index/cydir/cydir-storage.c	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/index/cydir/cydir-storage.c	Thu Jun 04 20:13:40 2009 -0400
@@ -385,6 +385,7 @@ struct mailbox cydir_mailbox = {
 		index_transaction_rollback,
 		index_transaction_set_max_modseq,
 		index_keywords_create,
+		index_keywords_create_from_indexes,
 		index_keywords_free,
 		index_keyword_is_valid,
 		index_storage_get_seq_range,
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/index/dbox/dbox-storage.c
--- a/src/lib-storage/index/dbox/dbox-storage.c	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/index/dbox/dbox-storage.c	Thu Jun 04 20:13:40 2009 -0400
@@ -786,6 +786,7 @@ struct mailbox dbox_mailbox = {
 		index_transaction_rollback,
 		index_transaction_set_max_modseq,
 		index_keywords_create,
+		index_keywords_create_from_indexes,
 		index_keywords_free,
 		index_keyword_is_valid,
 		index_storage_get_seq_range,
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/index/index-storage.c	Thu Jun 04 20:13:40 2009 -0400
@@ -598,6 +598,15 @@ int index_keywords_create(struct mailbox
 	return 0;
 }
 
+struct mail_keywords *
+index_keywords_create_from_indexes(struct mailbox *_box,
+				   const ARRAY_TYPE(keyword_indexes) *idx)
+{
+	struct index_mailbox *ibox = (struct index_mailbox *)_box;
+
+	return mail_index_keywords_create_from_indexes(ibox->index, idx);
+}
+
 void index_keywords_free(struct mail_keywords *keywords)
 {
 	mail_index_keywords_free(&keywords);
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/index/index-storage.h
--- a/src/lib-storage/index/index-storage.h	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/index/index-storage.h	Thu Jun 04 20:13:40 2009 -0400
@@ -106,6 +106,9 @@ bool index_storage_is_inconsistent(struc
 
 int index_keywords_create(struct mailbox *box, const char *const keywords[],
 			  struct mail_keywords **keywords_r, bool skip_invalid);
+struct mail_keywords *
+index_keywords_create_from_indexes(struct mailbox *box,
+				   const ARRAY_TYPE(keyword_indexes) *idx);
 void index_keywords_free(struct mail_keywords *keywords);
 bool index_keyword_is_valid(struct mailbox *box, const char *keyword,
 			    const char **error_r);
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Thu Jun 04 20:13:40 2009 -0400
@@ -1069,6 +1069,7 @@ struct mailbox maildir_mailbox = {
 		index_transaction_rollback,
 		index_transaction_set_max_modseq,
 		index_keywords_create,
+		index_keywords_create_from_indexes,
 		index_keywords_free,
 		index_keyword_is_valid,
 		index_storage_get_seq_range,
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Thu Jun 04 20:13:40 2009 -0400
@@ -902,6 +902,7 @@ struct mailbox mbox_mailbox = {
 		index_transaction_rollback,
 		index_transaction_set_max_modseq,
 		index_keywords_create,
+		index_keywords_create_from_indexes,
 		index_keywords_free,
 		index_keyword_is_valid,
 		index_storage_get_seq_range,
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/index/raw/raw-storage.c
--- a/src/lib-storage/index/raw/raw-storage.c	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/index/raw/raw-storage.c	Thu Jun 04 20:13:40 2009 -0400
@@ -236,6 +236,7 @@ struct mailbox raw_mailbox = {
 		index_transaction_rollback,
 		index_transaction_set_max_modseq,
 		index_keywords_create,
+		index_keywords_create_from_indexes,
 		index_keywords_free,
 		index_keyword_is_valid,
 		index_storage_get_seq_range,
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/mail-storage-private.h	Thu Jun 04 20:13:40 2009 -0400
@@ -149,6 +149,9 @@ struct mailbox_vfuncs {
 			       const char *const keywords[],
 			       struct mail_keywords **keywords_r,
 			       bool skip_invalid);
+	struct mail_keywords *
+		(*keywords_create_from_indexes)(struct mailbox *box,
+						const ARRAY_TYPE(keyword_indexes) *idx);
 	void (*keywords_free)(struct mail_keywords *keywords);
 	bool (*keyword_is_valid)(struct mailbox *box, const char *keyword,
 				 const char **error_r);
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/mail-storage.c	Thu Jun 04 20:13:40 2009 -0400
@@ -66,7 +66,8 @@ void mail_storage_class_unregister(struc
 		}
 	}
 
-	storage_class->v.class_deinit();
+	if (storage_class->v.class_deinit != NULL)
+		storage_class->v.class_deinit();
 }
 
 struct mail_storage *mail_storage_find_class(const char *name)
@@ -322,7 +323,8 @@ void mail_storage_unref(struct mail_stor
 
 	DLLIST_REMOVE(&storage->user->storages, storage);
 
-	storage->v.destroy(storage);
+	if (storage->v.destroy != NULL)
+		storage->v.destroy(storage);
 	i_free(storage->error_string);
 	pool_unref(&storage->pool);
 }
@@ -642,6 +644,13 @@ mailbox_keywords_create_valid(struct mai
 	return kw;
 }
 
+struct mail_keywords *
+mailbox_keywords_create_from_indexes(struct mailbox *box,
+				     const ARRAY_TYPE(keyword_indexes) *idx)
+{
+	return box->v.keywords_create_from_indexes(box, idx);
+}
+
 void mailbox_keywords_free(struct mailbox *box,
 			   struct mail_keywords **_keywords)
 {
diff -r 87e533f1127d -r 374d29a1905e src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Thu Jun 04 19:30:46 2009 -0400
+++ b/src/lib-storage/mail-storage.h	Thu Jun 04 20:13:40 2009 -0400
@@ -390,6 +390,9 @@ struct mail_keywords *
 struct mail_keywords *
 mailbox_keywords_create_valid(struct mailbox *box,
 			      const char *const keywords[]);
+struct mail_keywords *
+mailbox_keywords_create_from_indexes(struct mailbox *box,
+				     const ARRAY_TYPE(keyword_indexes) *idx);
 void mailbox_keywords_free(struct mailbox *box,
 			   struct mail_keywords **keywords);
 /* Returns TRUE if keyword is valid, FALSE and error if not. */


More information about the dovecot-cvs mailing list