]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Reverted 7a3b52b8f - doveadm sync -1 -R is useful.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 6 Apr 2016 19:08:14 +0000 (22:08 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 6 Apr 2016 19:08:14 +0000 (22:08 +0300)
src/doveadm/doveadm-dsync.c

index af5748e2d753fcce4390cb3500091a465da463b3..c53bf86c3ed66ff8dfcf9e316bd3a44faf0684c0 100644 (file)
@@ -38,7 +38,7 @@
 #include <ctype.h>
 #include <sys/wait.h>
 
-#define DSYNC_COMMON_GETOPT_ARGS "+1a:dDEfg:l:m:n:NO:Pr:s:t:T:Ux:"
+#define DSYNC_COMMON_GETOPT_ARGS "+1a:dDEfg:l:m:n:NO:Pr:Rs:t:T:Ux:"
 #define DSYNC_REMOTE_CMD_EXIT_WAIT_SECS 30
 /* The broken_char is mainly set to get a proper error message when trying to
    convert a mailbox with a name that can't be used properly translated between
@@ -1042,9 +1042,13 @@ cmd_mailbox_dsync_parse_arg(struct doveadm_mail_cmd_context *_ctx, int c)
        return TRUE;
 }
 
-static void cmd_dsync_init_common(struct dsync_cmd_context *ctx)
+static struct doveadm_mail_cmd_context *cmd_dsync_alloc(void)
 {
+       struct dsync_cmd_context *ctx;
+
+       ctx = doveadm_mail_cmd_alloc(struct dsync_cmd_context);
        ctx->io_timeout_secs = DSYNC_DEFAULT_IO_STREAM_TIMEOUT_SECS;
+       ctx->ctx.getopt_args = DSYNC_COMMON_GETOPT_ARGS;
        ctx->ctx.v.parse_arg = cmd_mailbox_dsync_parse_arg;
        ctx->ctx.v.preinit = cmd_dsync_preinit;
        ctx->ctx.v.init = cmd_dsync_init;
@@ -1056,27 +1060,18 @@ static void cmd_dsync_init_common(struct dsync_cmd_context *ctx)
                             DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE);
        p_array_init(&ctx->exclude_mailboxes, ctx->ctx.pool, 4);
        p_array_init(&ctx->namespace_prefixes, ctx->ctx.pool, 4);
-}
-
-static struct doveadm_mail_cmd_context *cmd_dsync_alloc(void)
-{
-       struct dsync_cmd_context *ctx;
-
-       ctx = doveadm_mail_cmd_alloc(struct dsync_cmd_context);
-       ctx->ctx.getopt_args = DSYNC_COMMON_GETOPT_ARGS;
-       cmd_dsync_init_common(ctx);
        return &ctx->ctx;
 }
 
 static struct doveadm_mail_cmd_context *cmd_dsync_backup_alloc(void)
 {
+       struct doveadm_mail_cmd_context *_ctx;
        struct dsync_cmd_context *ctx;
 
-       ctx = doveadm_mail_cmd_alloc(struct dsync_cmd_context);
+       _ctx = cmd_dsync_alloc();
+       ctx = (struct dsync_cmd_context *)_ctx;
        ctx->backup = TRUE;
-       ctx->ctx.getopt_args = DSYNC_COMMON_GETOPT_ARGS"R";
-       cmd_dsync_init_common(ctx);
-       return &ctx->ctx;
+       return _ctx;
 }
 
 static int
@@ -1187,7 +1182,7 @@ static struct doveadm_mail_cmd_context *cmd_dsync_server_alloc(void)
 
 struct doveadm_mail_cmd cmd_dsync_mirror = {
        cmd_dsync_alloc, "sync",
-       "[-1fPU] [-l <secs>] [-r <rawlog path>] [-m <mailbox>] [-g <mailbox_guid>] [-n <namespace> | -N] [-x <exclude>] [-s <state>] -d|<dest>"
+       "[-1fPRU] [-l <secs>] [-r <rawlog path>] [-m <mailbox>] [-g <mailbox_guid>] [-n <namespace> | -N] [-x <exclude>] [-s <state>] -d|<dest>"
 };
 struct doveadm_mail_cmd cmd_dsync_backup = {
        cmd_dsync_backup_alloc, "backup",