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.
This commit is contained in:
Oswald Buddenhagen 2013-11-24 19:39:33 +01:00
parent c0ba0c7ecf
commit f586c0bee5
2 changed files with 13 additions and 9 deletions

View File

@ -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 ))
{

View File

@ -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