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

cras at dovecot.org cras at dovecot.org
Fri Jun 16 12:22:18 EEST 2006


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

Modified Files:
	convert-storage.c 
Log Message:
Convert subscriptions also.



Index: convert-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/convert/convert-storage.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- convert-storage.c	8 Jun 2006 17:07:25 -0000	1.6
+++ convert-storage.c	16 Jun 2006 09:22:16 -0000	1.7
@@ -180,6 +180,28 @@
 	return ret;
 }
 
+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;
+	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,
+						TRUE) < 0) {
+			ret = -1;
+			break;
+		}
+	}
+	if (mail_storage_mailbox_list_deinit(&iter) < 0)
+		ret = -1;
+	return ret;
+}
+
 int convert_storage(const char *user, const char *home_dir,
 		    const char *source_data, const char *dest_data)
 {
@@ -225,6 +247,10 @@
 		ret = -1;
 	} else {
 		ret = mailbox_list_copy(source_storage, dest_storage, dotlock);
+		if (ret == 0) {
+			ret = mailbox_list_copy_subscriptions(source_storage,
+							      dest_storage);
+		}
 	}
 
 	if (ret == 0) {



More information about the dovecot-cvs mailing list