dovecot-2.0: Deleted convert plugin and convert-tool. dsync repl...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Dec 14 03:14:24 EET 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/2c9b01cb6e08
changeset: 10469:2c9b01cb6e08
user: Timo Sirainen <tss at iki.fi>
date: Sun Dec 13 20:14:18 2009 -0500
description:
Deleted convert plugin and convert-tool. dsync replaces them.
diffstat:
9 files changed, 1 insertion(+), 680 deletions(-)
.hgignore | 2
configure.in | 1
src/plugins/Makefile.am | 1
src/plugins/convert/Makefile.am | 40 --
src/plugins/convert/convert-plugin.c | 63 ----
src/plugins/convert/convert-plugin.h | 7
src/plugins/convert/convert-storage.c | 464 ---------------------------------
src/plugins/convert/convert-storage.h | 16 -
src/plugins/convert/convert-tool.c | 87 ------
diffs (truncated from 742 to 300 lines):
diff -r da03d0ecd3e7 -r 2c9b01cb6e08 .hgignore
--- a/.hgignore Sun Dec 13 20:09:00 2009 -0500
+++ b/.hgignore Sun Dec 13 20:14:18 2009 -0500
@@ -74,7 +74,6 @@ src/lmtp/lmtp
src/lmtp/lmtp
src/master/dovecot
src/ssl-params/ssl-params
-src/plugins/convert/convert-tool
src/plugins/expire/expire-tool
src/plugins/fts-squat/squat-test
src/pop3-login/pop3-login
@@ -84,6 +83,7 @@ src/util/listview
src/util/listview
src/util/maildirlock
src/util/rawlog
+src/util/script
src/plugins/quota/rquota_xdr.c
src/plugins/quota/rquota.h
diff -r da03d0ecd3e7 -r 2c9b01cb6e08 configure.in
--- a/configure.in Sun Dec 13 20:09:00 2009 -0500
+++ b/configure.in Sun Dec 13 20:14:18 2009 -0500
@@ -2593,7 +2593,6 @@ src/plugins/acl/Makefile
src/plugins/acl/Makefile
src/plugins/imap-acl/Makefile
src/plugins/autocreate/Makefile
-src/plugins/convert/Makefile
src/plugins/expire/Makefile
src/plugins/fts/Makefile
src/plugins/fts-lucene/Makefile
diff -r da03d0ecd3e7 -r 2c9b01cb6e08 src/plugins/Makefile.am
--- a/src/plugins/Makefile.am Sun Dec 13 20:09:00 2009 -0500
+++ b/src/plugins/Makefile.am Sun Dec 13 20:14:18 2009 -0500
@@ -14,7 +14,6 @@ SUBDIRS = \
acl \
imap-acl \
autocreate \
- convert \
expire \
fts \
fts-squat \
diff -r da03d0ecd3e7 -r 2c9b01cb6e08 src/plugins/convert/Makefile.am
--- a/src/plugins/convert/Makefile.am Sun Dec 13 20:09:00 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-pkglibexecdir = $(libexecdir)/dovecot
-
-AM_CPPFLAGS = \
- -I$(top_srcdir)/src/lib \
- -I$(top_srcdir)/src/lib-master \
- -I$(top_srcdir)/src/lib-mail \
- -I$(top_srcdir)/src/lib-index \
- -I$(top_srcdir)/src/lib-storage
-
-lib20_convert_plugin_la_LDFLAGS = -module -avoid-version
-
-module_LTLIBRARIES = \
- lib20_convert_plugin.la
-
-lib20_convert_plugin_la_SOURCES = \
- convert-storage.c \
- convert-plugin.c
-
-noinst_HEADERS = \
- convert-storage.h \
- convert-plugin.h
-
-pkglibexec_PROGRAMS = convert-tool
-
-convert_tool_SOURCES = \
- convert-tool.c
-
-common_objects = \
- convert-storage.lo
-
-libs = \
- $(LIBDOVECOT_STORAGE) \
- $(common_objects)
-
-convert_tool_LDADD = \
- $(libs) \
- $(LIBDOVECOT) \
- $(MODULE_LIBS)
-
-convert_tool_DEPENDENCIES = $(libs) $(LIBDOVECOT_DEPS)
diff -r da03d0ecd3e7 -r 2c9b01cb6e08 src/plugins/convert/convert-plugin.c
--- a/src/plugins/convert/convert-plugin.c Sun Dec 13 20:09:00 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/* Copyright (c) 2006-2009 Dovecot authors, see the included COPYING file */
-
-#include "lib.h"
-#include "mail-namespace.h"
-#include "mail-storage-hooks.h"
-#include "convert-storage.h"
-#include "convert-plugin.h"
-
-#include <stdlib.h>
-
-const char *convert_plugin_version = PACKAGE_VERSION;
-
-static void convert_mail_storage(struct mail_namespace *namespaces,
- const char *convert_mail)
-{
- const char *str;
- struct convert_plugin_settings set;
-
- memset(&set, 0, sizeof(set));
- if (mail_user_get_home(namespaces->user, &str) <= 0)
- i_fatal("convert plugin: HOME unset");
-
- set.skip_broken_mailboxes =
- mail_user_plugin_getenv(namespaces->user,
- "convert_skip_broken_mailboxes") != NULL;
- set.skip_dotdirs =
- mail_user_plugin_getenv(namespaces->user,
- "convert_skip_dotdirs") != NULL;
-
- str = mail_user_plugin_getenv(namespaces->user,
- "convert_alt_hierarchy_char");
- set.alt_hierarchy_char = str != NULL && *str != '\0' ? *str : '_';
-
- if (convert_storage(convert_mail, namespaces, &set) < 0)
- i_fatal("Mailbox conversion failed, exiting");
-}
-
-static void
-convert_mail_namespaces_created(struct mail_namespace *namespaces)
-{
- const char *convert_mail;
-
- convert_mail = mail_user_plugin_getenv(namespaces->user,
- "convert_mail");
- if (convert_mail != NULL)
- convert_mail_storage(namespaces, convert_mail);
- else if (namespaces->user->mail_debug)
- i_debug("convert: No convert_mail setting - plugin disabled");
-}
-
-static struct mail_storage_hooks convert_mail_storage_hooks = {
- .mail_namespaces_created = convert_mail_namespaces_created
-};
-
-void convert_plugin_init(struct module *module)
-{
- mail_storage_hooks_add(module, &convert_mail_storage_hooks);
-}
-
-void convert_plugin_deinit(void)
-{
- mail_storage_hooks_remove(&convert_mail_storage_hooks);
-}
diff -r da03d0ecd3e7 -r 2c9b01cb6e08 src/plugins/convert/convert-plugin.h
--- a/src/plugins/convert/convert-plugin.h Sun Dec 13 20:09:00 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#ifndef CONVERT_PLUGIN_H
-#define CONVERT_PLUGIN_H
-
-void convert_plugin_init(struct module *module);
-void convert_plugin_deinit(void);
-
-#endif
diff -r da03d0ecd3e7 -r 2c9b01cb6e08 src/plugins/convert/convert-storage.c
--- a/src/plugins/convert/convert-storage.c Sun Dec 13 20:09:00 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,464 +0,0 @@
-/* Copyright (c) 2006-2009 Dovecot authors, see the included COPYING file */
-
-#include "lib.h"
-#include "str.h"
-#include "file-lock.h"
-#include "file-dotlock.h"
-#include "mail-storage-private.h"
-#include "mail-namespace.h"
-#include "mail-search-build.h"
-#include "convert-storage.h"
-
-#include <stdio.h>
-#include <dirent.h>
-
-#define CONVERT_LOCK_FILENAME ".dovecot.convert"
-
-static struct dotlock_settings dotlock_settings = {
- .timeout = 60*5,
- .stale_timeout = 60*5
-};
-
-static const char *storage_error(struct mail_storage *storage)
-{
- enum mail_error error;
-
- return mail_storage_get_last_error(storage, &error);
-}
-
-static int mailbox_copy_mails(struct mailbox *srcbox, struct mailbox *destbox,
- struct dotlock *dotlock, const char **error_r)
-{
- struct mail_search_context *ctx;
- struct mailbox_transaction_context *src_trans, *dest_trans;
- struct mail_save_context *save_ctx;
- struct mail *mail;
- struct mail_search_args *search_args;
- int ret = 0;
-
- if (mailbox_sync(srcbox, MAILBOX_SYNC_FLAG_FULL_READ, 0, NULL) < 0) {
- *error_r = storage_error(srcbox->storage);
- return -1;
- }
- *error_r = NULL;
-
- search_args = mail_search_build_init();
- mail_search_build_add_all(search_args);
-
- src_trans = mailbox_transaction_begin(srcbox, 0);
- dest_trans = mailbox_transaction_begin(destbox,
- MAILBOX_TRANSACTION_FLAG_EXTERNAL);
-
- ctx = mailbox_search_init(src_trans, search_args, NULL);
- mail_search_args_unref(&search_args);
-
- mail = mail_alloc(src_trans,
- MAIL_FETCH_FLAGS | MAIL_FETCH_RECEIVED_DATE |
- MAIL_FETCH_STREAM_HEADER | MAIL_FETCH_STREAM_BODY |
- MAIL_FETCH_FROM_ENVELOPE, NULL);
- while (mailbox_search_next(ctx, mail)) {
- if ((mail->seq % 100) == 0) {
- /* touch the lock file so that if there are tons of
- mails another process won't override our lock. */
- (void)file_dotlock_touch(dotlock);
- }
-
- save_ctx = mailbox_save_alloc(dest_trans);
- mailbox_save_copy_flags(save_ctx, mail);
- ret = mailbox_copy(&save_ctx, mail);
- if (ret < 0) {
- *error_r = storage_error(destbox->storage);
- break;
- }
- }
-
- mail_free(&mail);
- if (mailbox_search_deinit(&ctx) < 0) {
- ret = -1;
- *error_r = storage_error(srcbox->storage);
- }
-
- if (ret < 0)
- mailbox_transaction_rollback(&dest_trans);
- else {
- ret = mailbox_transaction_commit(&dest_trans);
- if (ret < 0)
- *error_r = storage_error(destbox->storage);
- }
-
- /* source transaction committing isn't all that important.
- ignore if it fails. */
- if (ret < 0)
- mailbox_transaction_rollback(&src_trans);
- else
- (void)mailbox_transaction_commit(&src_trans);
- i_assert(ret == 0 || *error_r != NULL);
- return ret;
-}
-
-static const char *
-mailbox_name_convert(struct mail_namespace *dest_ns,
- struct mail_namespace *source_ns,
- const struct convert_plugin_settings *set,
- const char *name)
-{
- char *dest_name, *p, src_sep, dest_sep;
-
- src_sep = mailbox_list_get_hierarchy_sep(source_ns->list);
- dest_sep = mailbox_list_get_hierarchy_sep(dest_ns->list);
-
- if (src_sep == dest_sep)
- return name;
-
- dest_name = t_strdup_noconst(name);
- for (p = dest_name; *p != '\0'; p++) {
- if (*p == dest_sep && set->alt_hierarchy_char != '\0')
- *p = set->alt_hierarchy_char;
- else if (*p == src_sep)
- *p = dest_sep;
- }
- return dest_name;
-}
-
-static int
-mailbox_convert_maildir_to_dbox(struct mail_namespace *source_ns,
- struct mail_namespace *dest_ns,
- const char *src_name, const char *dest_name)
-{
- static const char *maildir_files[] = {
- "dovecot-uidlist",
- "dovecot-keywords",
- "dovecot.index",
- "dovecot.index.log",
- "dovecot.index.cache"
More information about the dovecot-cvs
mailing list