comparison 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
comparison
equal deleted inserted replaced
3971:539a58176e7b 3972:a506ee4ec31e
1 /* Copyright (C) 2006 Timo Sirainen */
2
3 #include "lib.h"
4 #include "ioloop.h"
5 #include "randgen.h"
6 #include "lib-signals.h"
7 #include "convert-storage.h"
8
9 /* ugly, but automake doesn't like having it built as both static and
10 dynamic object.. */
11 #include "convert-storage.c"
12
13 int main(int argc, const char *argv[])
14 {
15 struct ioloop *ioloop;
16 int ret = 0;
17
18 lib_init();
19 lib_signals_init();
20 random_init();
21 mail_storage_init();
22 mail_storage_register_all();
23
24 if (argc <= 4) {
25 i_fatal("Usage: <username> <home dir> "
26 "<source mail env> <dest mail env>");
27 }
28
29 ioloop = io_loop_create(system_pool);
30
31 ret = convert_storage(argv[1], argv[2], argv[3], argv[4]);
32 if (ret > 0)
33 i_info("Successfully converted");
34 else if (ret == 0)
35 i_error("Source storage not found");
36 else
37 i_error("Internal failure");
38
39 io_loop_destroy(&ioloop);
40 mail_storage_deinit();
41 lib_signals_deinit();
42 lib_deinit();
43 return ret;
44 }