[dovecot-cvs] dovecot/src/plugins/convert Makefile.am, 1.6, 1.7 convert-storage.c, 1.7, 1.8

tss at dovecot.org tss at dovecot.org
Thu Nov 16 00:17:20 UTC 2006


Update of /var/lib/cvs/dovecot/src/plugins/convert
In directory talvi:/tmp/cvs-serv25364/src/plugins/convert

Modified Files:
	Makefile.am convert-storage.c 
Log Message:
Initial code for separation of mailbox accessing and directory layout
handling. It's not yet possible to change the default layouts though.



Index: Makefile.am
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/convert/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile.am	31 Jul 2006 00:44:33 -0000	1.6
+++ Makefile.am	16 Nov 2006 00:17:16 -0000	1.7
@@ -29,7 +29,7 @@
 	$(top_builddir)/src/lib-storage/register/libstorage-register.a \
 	$(STORAGE_LIBS) \
 	$(top_builddir)/src/lib-storage/libstorage.a \
-	$(top_builddir)/src/lib-storage/subscription-file/libstorage_subscription_file.a \
+	$(top_builddir)/src/lib-storage/list/libstorage_list.a \
 	$(top_builddir)/src/lib-imap/libimap.a \
 	$(top_builddir)/src/lib-mail/libmail.a \
 	$(top_builddir)/src/lib-charset/libcharset.a \

Index: convert-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/convert/convert-storage.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- convert-storage.c	16 Jun 2006 09:22:16 -0000	1.7
+++ convert-storage.c	16 Nov 2006 00:17:16 -0000	1.8
@@ -100,18 +100,18 @@
 
 static int mailbox_convert_list_item(struct mail_storage *source_storage,
 				     struct mail_storage *dest_storage,
-				     struct mailbox_list *list,
+				     struct mailbox_info *info,
 				     struct dotlock *dotlock)
 {
 	const char *name;
 	struct mailbox *srcbox, *destbox;
 	int ret = 0;
 
-	if ((list->flags & (MAILBOX_NONEXISTENT|MAILBOX_PLACEHOLDER)) != 0)
+	if ((info->flags & (MAILBOX_NONEXISTENT|MAILBOX_PLACEHOLDER)) != 0)
 		return 0;
 
-	name = strcasecmp(list->name, "INBOX") == 0 ? "INBOX" : list->name;
-	if ((list->flags & MAILBOX_NOSELECT) != 0) {
+	name = strcasecmp(info->name, "INBOX") == 0 ? "INBOX" : info->name;
+	if ((info->flags & MAILBOX_NOSELECT) != 0) {
 		if (mail_storage_mailbox_create(dest_storage, name, TRUE) < 0) {
 			i_error("Mailbox conversion: Couldn't create mailbox "
 				"directory %s", name);
@@ -158,15 +158,15 @@
 			     struct mail_storage *dest_storage,
 			     struct dotlock *dotlock)
 {
-	struct mailbox_list_context *iter;
-	struct mailbox_list *list;
+	struct mailbox_list_iterate_context *iter;
+	struct mailbox_info *info;
 	int ret = 0;
 
-	iter = mail_storage_mailbox_list_init(source_storage, "", "*",
-                                              MAILBOX_LIST_FAST_FLAGS);
-	while ((list = mail_storage_mailbox_list_next(iter)) != NULL) {
+	iter = mailbox_list_iter_init(mail_storage_get_list(source_storage),
+				      "", "*", MAILBOX_LIST_ITER_FAST_FLAGS);
+	while ((info = mailbox_list_iter_next(iter)) != NULL) {
 		if (mailbox_convert_list_item(source_storage, dest_storage,
-					      list, dotlock) < 0) {
+					      info, dotlock) < 0) {
 			ret = -1;
 			break;
 		}
@@ -175,7 +175,7 @@
 		   is done only after 100 mails. */
 		(void)file_dotlock_touch(dotlock);
 	}
-	if (mail_storage_mailbox_list_deinit(&iter) < 0)
+	if (mailbox_list_iter_deinit(&iter) < 0)
 		ret = -1;
 	return ret;
 }
@@ -183,21 +183,23 @@
 static int mailbox_list_copy_subscriptions(struct mail_storage *source_storage,
 					   struct mail_storage *dest_storage)
 {
-	struct mailbox_list_context *iter;
-	struct mailbox_list *list;
+	struct mailbox_list_iterate_context *iter;
+	struct mailbox_info *info;
+	struct mailbox_list *dest_list;
 	int ret = 0;
 
-	iter = mail_storage_mailbox_list_init(source_storage, "", "*",
-					      MAILBOX_LIST_SUBSCRIBED |
-					      MAILBOX_LIST_FAST_FLAGS);
-	while ((list = mail_storage_mailbox_list_next(iter)) != NULL) {
-		if (mail_storage_set_subscribed(dest_storage, list->name,
+	dest_list = mail_storage_get_list(dest_storage);
+	iter = mailbox_list_iter_init(mail_storage_get_list(source_storage),
+				      "", "*", MAILBOX_LIST_ITER_SUBSCRIBED |
+				      MAILBOX_LIST_ITER_FAST_FLAGS);
+	while ((info = mailbox_list_iter_next(iter)) != NULL) {
+		if (mailbox_list_set_subscribed(dest_list, info->name,
 						TRUE) < 0) {
 			ret = -1;
 			break;
 		}
 	}
-	if (mail_storage_mailbox_list_deinit(&iter) < 0)
+	if (mailbox_list_iter_deinit(&iter) < 0)
 		ret = -1;
 	return ret;
 }



More information about the dovecot-cvs mailing list