dovecot-2.2: dsync: Moved all doveadm-specific code to doveadm-d...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Sep 15 15:02:16 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/eff79a80e0c9
changeset: 17800:eff79a80e0c9
user: Timo Sirainen <tss at iki.fi>
date: Mon Sep 15 18:02:02 2014 +0300
description:
dsync: Moved all doveadm-specific code to doveadm-dsync.c
diffstat:
src/doveadm/dsync/doveadm-dsync.c | 1 +
src/doveadm/dsync/dsync-brain-mailbox-tree.c | 13 +++++--------
src/doveadm/dsync/dsync-brain-private.h | 1 +
src/doveadm/dsync/dsync-brain.c | 2 ++
src/doveadm/dsync/dsync-brain.h | 3 +++
src/doveadm/dsync/dsync-mailbox-tree.c | 1 -
6 files changed, 12 insertions(+), 9 deletions(-)
diffs (109 lines):
diff -r 25fd54c05522 -r eff79a80e0c9 src/doveadm/dsync/doveadm-dsync.c
--- a/src/doveadm/dsync/doveadm-dsync.c Mon Sep 15 11:19:50 2014 +0300
+++ b/src/doveadm/dsync/doveadm-dsync.c Mon Sep 15 18:02:02 2014 +0300
@@ -541,6 +541,7 @@
memcpy(set.sync_box_guid, ctx->mailbox_guid, sizeof(set.sync_box_guid));
set.lock_timeout_secs = ctx->lock_timeout;
set.state = ctx->state_input;
+ set.mailbox_alt_char = doveadm_settings->dsync_alt_char[0];
if (array_count(&ctx->exclude_mailboxes) > 0) {
/* array is NULL-terminated in init() */
set.exclude_mailboxes = array_idx(&ctx->exclude_mailboxes, 0);
diff -r 25fd54c05522 -r eff79a80e0c9 src/doveadm/dsync/dsync-brain-mailbox-tree.c
--- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c Mon Sep 15 11:19:50 2014 +0300
+++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c Mon Sep 15 18:02:02 2014 +0300
@@ -3,7 +3,6 @@
#include "lib.h"
#include "str.h"
#include "mail-namespace.h"
-#include "doveadm-settings.h"
#include "dsync-ibc.h"
#include "dsync-mailbox-tree.h"
#include "dsync-brain-private.h"
@@ -47,12 +46,10 @@
dsync_brain_check_namespaces(brain);
brain->local_mailbox_tree =
- dsync_mailbox_tree_init(brain->hierarchy_sep,
- doveadm_settings->dsync_alt_char[0]);
+ dsync_mailbox_tree_init(brain->hierarchy_sep, brain->alt_char);
/* we'll convert remote mailbox names to use our own separator */
brain->remote_mailbox_tree =
- dsync_mailbox_tree_init(brain->hierarchy_sep,
- doveadm_settings->dsync_alt_char[0]);
+ dsync_mailbox_tree_init(brain->hierarchy_sep, brain->alt_char);
/* fill the local mailbox tree */
for (ns = brain->user->namespaces; ns != NULL; ns = ns->next) {
@@ -238,7 +235,7 @@
struct mail_namespace *ns;
const char *p;
string_t *vname;
- char ns_sep, alt_char = doveadm_settings->dsync_alt_char[0];
+ char ns_sep;
i_assert(*name_parts != NULL);
@@ -254,13 +251,13 @@
if (*p != ns_sep)
str_append_c(vname, *p);
else
- str_append_c(vname, alt_char);
+ str_append_c(vname, brain->alt_char);
}
str_append_c(vname, ns_sep);
}
str_truncate(vname, str_len(vname)-1);
- dsync_fix_mailbox_name(ns, vname, alt_char);
+ dsync_fix_mailbox_name(ns, vname, brain->alt_char);
*name_r = str_c(vname);
*ns_r = ns;
return 0;
diff -r 25fd54c05522 -r eff79a80e0c9 src/doveadm/dsync/dsync-brain-private.h
--- a/src/doveadm/dsync/dsync-brain-private.h Mon Sep 15 11:19:50 2014 +0300
+++ b/src/doveadm/dsync/dsync-brain-private.h Mon Sep 15 18:02:02 2014 +0300
@@ -55,6 +55,7 @@
guid_128_t sync_box_guid;
const char *const *exclude_mailboxes;
enum dsync_brain_sync_type sync_type;
+ char alt_char;
unsigned int lock_timeout;
int lock_fd;
diff -r 25fd54c05522 -r eff79a80e0c9 src/doveadm/dsync/dsync-brain.c
--- a/src/doveadm/dsync/dsync-brain.c Mon Sep 15 11:19:50 2014 +0300
+++ b/src/doveadm/dsync/dsync-brain.c Mon Sep 15 18:02:02 2014 +0300
@@ -171,6 +171,8 @@
}
str_delete(sync_ns_str, str_len(sync_ns_str)-1, 1);
}
+ brain->alt_char = set->mailbox_alt_char == '\0' ? '_' :
+ set->mailbox_alt_char;
brain->sync_box = p_strdup(brain->pool, set->sync_box);
brain->exclude_mailboxes = set->exclude_mailboxes == NULL ? NULL :
p_strarray_dup(brain->pool, set->exclude_mailboxes);
diff -r 25fd54c05522 -r eff79a80e0c9 src/doveadm/dsync/dsync-brain.h
--- a/src/doveadm/dsync/dsync-brain.h Mon Sep 15 11:19:50 2014 +0300
+++ b/src/doveadm/dsync/dsync-brain.h Mon Sep 15 18:02:02 2014 +0300
@@ -48,6 +48,9 @@
/* Exclude these mailboxes from the sync. They can contain '*'
wildcards and be \special-use flags. */
const char *const *exclude_mailboxes;
+ /* Alternative character to use in mailbox names where the original
+ character cannot be used. */
+ char mailbox_alt_char;
/* If non-zero, use dsync lock file for this user */
unsigned int lock_timeout_secs;
diff -r 25fd54c05522 -r eff79a80e0c9 src/doveadm/dsync/dsync-mailbox-tree.c
--- a/src/doveadm/dsync/dsync-mailbox-tree.c Mon Sep 15 11:19:50 2014 +0300
+++ b/src/doveadm/dsync/dsync-mailbox-tree.c Mon Sep 15 18:02:02 2014 +0300
@@ -4,7 +4,6 @@
#include "array.h"
#include "hash.h"
#include "str.h"
-#include "doveadm-settings.h"
#include "mailbox-list-private.h"
#include "dsync-mailbox-tree-private.h"
More information about the dovecot-cvs
mailing list