diff src/plugins/convert/convert-tool.c @ 3972:a506ee4ec31e HEAD

Added "mail storage conversion" plugin. It can be used with IMAP, POP3 and/or LDA to convert one complete mail storage to another format. Also included a convert-tool command line tool to do it manually. Currently doesn't support preserving UID/UIDVALIDITY.
author Timo Sirainen <tss@iki.fi>
date Thu, 02 Feb 2006 22:42:44 +0200
parents
children 5255476a24b5
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/plugins/convert/convert-tool.c	Thu Feb 02 22:42:44 2006 +0200
@@ -0,0 +1,44 @@
+/* Copyright (C) 2006 Timo Sirainen */
+
+#include "lib.h"
+#include "ioloop.h"
+#include "randgen.h"
+#include "lib-signals.h"
+#include "convert-storage.h"
+
+/* ugly, but automake doesn't like having it built as both static and
+   dynamic object.. */
+#include "convert-storage.c"
+
+int main(int argc, const char *argv[])
+{
+	struct ioloop *ioloop;
+	int ret = 0;
+
+	lib_init();
+	lib_signals_init();
+	random_init();
+	mail_storage_init();
+	mail_storage_register_all();
+
+	if (argc <= 4) {
+		i_fatal("Usage: <username> <home dir> "
+			"<source mail env> <dest mail env>");
+	}
+
+	ioloop = io_loop_create(system_pool);
+
+	ret = convert_storage(argv[1], argv[2], argv[3], argv[4]);
+	if (ret > 0)
+		i_info("Successfully converted");
+	else if (ret == 0)
+		i_error("Source storage not found");
+	else
+		i_error("Internal failure");
+
+	io_loop_destroy(&ioloop);
+	mail_storage_deinit();
+	lib_signals_deinit();
+	lib_deinit();
+	return ret;
+}