From f485d69332d90128f8c2d5769fd88aff2df50566 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 7 Dec 2013 16:41:05 +0100 Subject: [PATCH] refuse box list overrides if Channel has no Patterns as the named boxes are the same on both sides, they logically make sense only when the channel is in that mode anyway, which is the case when using patterns. --- src/main.c | 5 +++++ src/mbsync.1 | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 94043b8..cc44877 100644 --- a/src/main.c +++ b/src/main.c @@ -550,6 +550,11 @@ sync_chans( main_vars_t *mvars, int ent ) gotchan: mvars->chan = chan; if (boxp) { + if (!chan->patterns) { + error( "Cannot override mailbox in channel '%s' - no Patterns.\n", channame ); + mvars->ret = 1; + goto gotnone; + } mvars->boxlist = 1; for (;;) { nboxp = strpbrk( boxp, ",\n" ); diff --git a/src/mbsync.1 b/src/mbsync.1 index 867b90b..e06d6fe 100644 --- a/src/mbsync.1 +++ b/src/mbsync.1 @@ -367,10 +367,8 @@ Define the Channel \fIname\fR, opening a section for its parameters. .TP {\fBMaster\fR|\fBSlave\fR} \fB:\fIstore\fB:\fR[\fImailbox\fR] Specify the Master resp. Slave Store to be connected by this Channel. -If \fImailbox\fR is omitted, \fBINBOX\fR is assumed. -The \fImailbox\fR specification can be overridden by \fBPatterns\fR, which -in turn can be overridden by a mailbox list in a Channel reference (a Group -specification or the command line). +If \fBPatterns\fR are specified, \fImailbox\fR is ignored. +Otherwise, if \fImailbox\fR is omitted, \fBINBOX\fR is assumed. .. .TP \fBPattern\fR[\fBs\fR] [\fB!\fR]\fIpattern\fR ... @@ -385,6 +383,9 @@ times); later matches take precedence. Note that \fBINBOX\fR is not matched by wildcards, unless it lives under \fBPath\fR. .br +The mailbox list selected by \fBPatterns\fR can be overridden by a mailbox +list in a channel reference (a \fBGroup\fR specification or the command line). +.br Example: "\fBPatterns\fR\ \fI%\ !Trash\fR" .. .TP @@ -524,8 +525,9 @@ with the same name on the command line. One or more Channels can be specified on the same line. .br If you supply one or more \fIbox\fRes to a \fIchannel\fR, they will be used -instead of what is specified in the Channel. The same can be done on the command -line, except that there newlines can be used as mailbox name separators as well. +instead of what is specified in the Channel's Patterns. +The same can be done on the command line, except that there newlines can be +used as mailbox name separators as well. .. .TP \fBChannel\fR[\fBs\fR] \fIchannel\fR[\fB:\fIbox\fR[\fB,\fR...]] ...