From f586c0bee5aac9218fb33f44c59d031ae0e0162b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 24 Nov 2013 19:39:33 +0100 Subject: [PATCH] make it possible to specify CopyArrivalDate and MaxMessages globally sneaky change on the side: the wording of the man page is changed from "outside any section" to "before any section" to get global options. this is not entirely true ... the previously existing options behave as before, while the two newcomers actually affect subsequent channels. --- src/config.c | 10 ++++++---- src/mbsync.1 | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/config.c b/src/config.c index 7fde567..c103c97 100644 --- a/src/config.c +++ b/src/config.c @@ -229,6 +229,10 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf ) conf->ops[M] |= XOP_HAVE_CREATE; } else if (!strcasecmp( "SyncState", cfile->cmd )) conf->sync_state = expand_strdup( cfile->val ); + else if (!strcasecmp( "CopyArrivalDate", cfile->cmd )) + conf->use_internal_date = parse_bool( cfile ); + else if (!strcasecmp( "MaxMessages", cfile->cmd )) + conf->max_messages = parse_int( cfile ); else return 0; return 1; @@ -364,15 +368,13 @@ load_config( const char *where, int pseudo ) { channel = nfcalloc( sizeof(*channel) ); channel->name = nfstrdup( cfile.val ); + channel->max_messages = global_conf.max_messages; + channel->use_internal_date = global_conf.use_internal_date; cops = 0; max_size = -1; while (getcline( &cfile ) && cfile.cmd) { if (!strcasecmp( "MaxSize", cfile.cmd )) max_size = parse_size( &cfile ); - else if (!strcasecmp( "MaxMessages", cfile.cmd )) - channel->max_messages = parse_int( &cfile ); - else if (!strcasecmp( "CopyArrivalDate", cfile.cmd )) - channel->use_internal_date = parse_bool( &cfile ); else if (!strcasecmp( "Pattern", cfile.cmd ) || !strcasecmp( "Patterns", cfile.cmd )) { diff --git a/src/mbsync.1 b/src/mbsync.1 index bdf5d3c..7813c6a 100644 --- a/src/mbsync.1 +++ b/src/mbsync.1 @@ -472,11 +472,6 @@ does not exist. Permanently remove all messages [on the Master/Slave] marked for deletion. (Global default: \fINone\fR) .. -.P -\fBSync\fR, \fBCreate\fR and \fBExpunge\fR can be used outside any section for -a global effect. The global settings are overridden by Channel-specific options, -which in turn are overridden by command line switches. -.. .TP \fBCopyArrivalDate\fR {\fIyes\fR|\fIno\fR} Selects whether their arrival time should be propagated together with @@ -487,6 +482,13 @@ Note that IMAP does not guarantee that the time stamp (termed \fBinternal date\fR) is actually the arrival time, but it is usually close enough. (Default: \fIno\fR) .. +.P +\fBSync\fR, \fBCreate\fR, \fBExpunge\fR, +\fBMaxMessages\fR, and \fBCopyArrivalDate\fR +can be used before any section for a global effect. +The global settings are overridden by Channel-specific options, +which in turn are overridden by command line switches. +.. .TP \fBSyncState\fR {\fB*\fR|\fIpath\fR} Set the location of this Channel's synchronization state files. \fB*\fR means