rename Delete to Gone

this is more symmetrical with New, and results in some less dodgy
grammar. it also avoids confusion with the \Deleted flag.

fwiw, the pedantically correct name would be Expunges, but that's
confusingly close to the target-side expunge options. also, it's longer.
This commit is contained in:
Oswald Buddenhagen 2022-05-18 19:03:22 +02:00
parent 6308a7f41b
commit 58564e4f76
8 changed files with 51 additions and 30 deletions

3
NEWS
View File

@ -9,7 +9,8 @@ is now the file's containing directory.
Placeholders will be now created for messages exceeding MaxSize even if
they are flagged on the source side.
Renamed the ReNew/--renew/-N options to Upgrade/--upgrade/-u.
Renamed the ReNew/--renew/-N options to Upgrade/--upgrade/-u
and Delete/--delete/-d to Gone/--gone/-g.
MaxMessages and MaxSize can be used together now.

View File

@ -198,8 +198,11 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf )
*cops |= OP_UPGRADE;
} else if (!strcasecmp( "New", arg )) {
*cops |= OP_NEW;
} else if (!strcasecmp( "Gone", arg )) {
*cops |= OP_GONE;
} else if (!strcasecmp( "Delete", arg )) {
*cops |= OP_DELETE;
cfile->delete_warn = 1;
*cops |= OP_GONE;
} else if (!strcasecmp( "Flags", arg )) {
*cops |= OP_FLAGS;
} else if (!strcasecmp( "PullUpgrade", arg )) {
@ -209,8 +212,11 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf )
conf->ops[N] |= OP_UPGRADE;
} else if (!strcasecmp( "PullNew", arg )) {
conf->ops[N] |= OP_NEW;
} else if (!strcasecmp( "PullGone", arg )) {
conf->ops[N] |= OP_GONE;
} else if (!strcasecmp( "PullDelete", arg )) {
conf->ops[N] |= OP_DELETE;
cfile->delete_warn = 1;
conf->ops[N] |= OP_GONE;
} else if (!strcasecmp( "PullFlags", arg )) {
conf->ops[N] |= OP_FLAGS;
} else if (!strcasecmp( "PushUpgrade", arg )) {
@ -220,8 +226,11 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf )
conf->ops[F] |= OP_UPGRADE;
} else if (!strcasecmp( "PushNew", arg )) {
conf->ops[F] |= OP_NEW;
} else if (!strcasecmp( "PushGone", arg )) {
conf->ops[F] |= OP_GONE;
} else if (!strcasecmp( "PushDelete", arg )) {
conf->ops[F] |= OP_DELETE;
cfile->delete_warn = 1;
conf->ops[F] |= OP_GONE;
} else if (!strcasecmp( "PushFlags", arg )) {
conf->ops[F] |= OP_FLAGS;
} else if (!strcasecmp( "All", arg ) || !strcasecmp( "Full", arg )) {
@ -345,7 +354,7 @@ merge_ops( int cops, int ops[], const char *chan_name )
if (cops & (XOP_PUSH | OP_MASK_TYPE)) {
// Mixing instant effect flags with row/column flags would be confusing,
// so instead everything is instant effect. This implies that mixing
// direction with type would cause overlaps, so PullNew Push Delete, etc.
// direction with type would cause overlaps, so PullNew Push Gone, etc.
// is invalid.
// Pull Push covers everything, so makes no sense to combine.
ivl:
@ -456,6 +465,7 @@ load_config( const char *where )
cfile.err = 0;
cfile.ms_warn = 0;
cfile.renew_warn = 0;
cfile.delete_warn = 0;
cfile.rest = NULL;
gcops = 0;
@ -629,6 +639,8 @@ load_config( const char *where )
warn( "Notice: Master/Slave are deprecated; use Far/Near instead.\n" );
if (cfile.renew_warn)
warn( "Notice: ReNew is deprecated; use Upgrade instead.\n" );
if (cfile.delete_warn)
warn( "Notice: Delete is deprecated; use Gone instead.\n" );
cfile.err |= merge_ops( gcops, global_conf.ops, "" );
if (!global_conf.sync_state) {
const char *state_home = getenv( "XDG_STATE_HOME" );

View File

@ -17,7 +17,7 @@ typedef struct {
int bufl;
int line;
int err;
int ms_warn, renew_warn;
int ms_warn, renew_warn, delete_warn;
int path_len;
char *cmd, *val, *rest;
} conffile_t;

View File

@ -35,7 +35,7 @@ PACKAGE " " VERSION " - mailbox synchronizer\n"
" -l, --list list mailboxes instead of syncing them\n"
" -ls, --list-stores raw listing of stores' mailboxes\n"
" -n, --new propagate new messages\n"
" -d, --delete propagate message deletions\n"
" -g, --gone propagate message disappearances (expunges)\n"
" -f, --flags propagate message flag changes\n"
" -u, --upgrade upgrade placeholders to full messages\n"
" -L, --pull propagate from far to near side\n"
@ -50,7 +50,7 @@ PACKAGE " " VERSION " - mailbox synchronizer\n"
" -v, --version display version\n"
" -h, --help display this help message\n"
"\nIf neither --pull nor --push are specified, both are active.\n"
"If neither --new, --delete, --flags, nor --upgrade are specified, all are\n"
"If neither --new, --gone, --flags, nor --upgrade are specified, all are\n"
"active. Direction and operation can be concatenated like --pull-new, etc.\n"
"--create, --remove, and --expunge can be suffixed with -far/-near.\n"
"See the man page for details.\n"
@ -144,7 +144,7 @@ main( int argc, char **argv )
{
core_vars_t mvars[1];
char *config = NULL, *opt, *ochar;
int oind, cops = 0, op, ms_warn = 0, renew_warn = 0;
int oind, cops = 0, op, ms_warn = 0, renew_warn = 0, delete_warn = 0;
tzset();
gethostname( Hostname, sizeof(Hostname) );
@ -279,8 +279,11 @@ main( int argc, char **argv )
} else if (!strcmp( opt, "renew" )) {
renew_warn = 1;
op |= OP_UPGRADE;
} else if (!strcmp( opt, "gone" )) {
op |= OP_GONE;
} else if (!strcmp( opt, "delete" )) {
op |= OP_DELETE;
delete_warn = 1;
op |= OP_GONE;
} else if (!strcmp( opt, "flags" )) {
op |= OP_FLAGS;
} else {
@ -352,6 +355,7 @@ main( int argc, char **argv )
break;
case 'n':
case 'd':
case 'g':
case 'f':
case 'N':
case 'u':
@ -361,8 +365,10 @@ main( int argc, char **argv )
for (;; ochar++) {
if (*ochar == 'n')
op |= OP_NEW;
else if (*ochar == 'g')
op |= OP_GONE;
else if (*ochar == 'd')
op |= OP_DELETE;
op |= OP_GONE, delete_warn = 1;
else if (*ochar == 'f')
op |= OP_FLAGS;
else if (*ochar == 'u')
@ -475,6 +481,8 @@ main( int argc, char **argv )
warn( "Notice: -master/-slave/m/s suffixes are deprecated; use -far/-near/f/n instead.\n" );
if (renew_warn)
warn( "Notice: --renew/-N are deprecated; use --upgrade/-u instead.\n" );
if (delete_warn)
warn( "Notice: --delete/-d are deprecated; use --gone/-g instead.\n" );
if (DFlags & DEBUG_ANY) {
Verbosity = VERBOSE;

View File

@ -61,11 +61,11 @@ Override any \fBRemove\fR options from the config file. See below.
\fB-X\fR[\fBf\fR][\fBn\fR], \fB--expunge\fR[\fB-far\fR|\fB-near\fR]
Override any \fBExpunge\fR options from the config file. See below.
.TP
{\fB-n\fR|\fB-u\fR|\fB-d\fR|\fB-f\fR|\fB-0\fR|\fB-F\fR},\
{\fB--new\fR|\fB--upgrade\fR|\fB--delete\fR|\fB--flags\fR|\fB--noop\fR|\fB--full\fR}
{\fB-n\fR|\fB-u\fR|\fB-g\fR|\fB-f\fR|\fB-0\fR|\fB-F\fR},\
{\fB--new\fR|\fB--upgrade\fR|\fB--gone\fR|\fB--flags\fR|\fB--noop\fR|\fB--full\fR}
.TP
\r{\fB-L\fR|\fB-H\fR}[\fBn\fR][\fBu\fR][\fBd\fR][\fBf\fR],\
{\fB--pull\fR|\fB--push\fR}[\fB-new\fR|\fB-upgrade\fR|\fB-delete\fR|\fB-flags\fR]
\r{\fB-L\fR|\fB-H\fR}[\fBn\fR][\fBu\fR][\fBg\fR][\fBf\fR],\
{\fB--pull\fR|\fB--push\fR}[\fB-new\fR|\fB-upgrade\fR|\fB-gone\fR|\fB-flags\fR]
Override any \fBSync\fR options from the config file. See below.
.TP
\fB-h\fR, \fB--help\fR
@ -574,7 +574,7 @@ case you need to enable this option.
(Global default: \fBno\fR).
.
.TP
\fBSync\fR {\fBNone\fR|[\fBPull\fR] [\fBPush\fR] [\fBNew\fR] [\fBUpgrade\fR] [\fBDelete\fR] [\fBFlags\fR]|\fBAll\fR}
\fBSync\fR {\fBNone\fR|[\fBPull\fR] [\fBPush\fR] [\fBNew\fR] [\fBUpgrade\fR] [\fBGone\fR] [\fBFlags\fR]|\fBAll\fR}
Select the synchronization operation(s) to perform:
.br
\fBPull\fR - propagate changes from far to near side.
@ -586,7 +586,7 @@ Select the synchronization operation(s) to perform:
\fBUpgrade\fR - upgrade placeholders to full messages. Useful only with
a configured \fBMaxSize\fR.
.br
\fBDelete\fR - propagate message deletions. This applies only to messages that
\fBGone\fR - propagate message disappearances. This applies only to messages that
are actually gone, i.e., were expunged. The affected messages in the opposite
Store are marked as deleted only, i.e., they won't be really deleted until
that Store is expunged.
@ -602,7 +602,7 @@ This is the global default.
Useful if you want to expunge only.
.IP
\fBPull\fR and \fBPush\fR are direction flags, while \fBNew\fR, \fBUpgrade\fR,
\fBDelete\fR and \fBFlags\fR are type flags. The two flag classes make up a
\fBGone\fR and \fBFlags\fR are type flags. The two flag classes make up a
two-dimensional matrix (a table). Its cells are the individual actions to
perform. There are two styles of asserting the cells:
.br
@ -611,7 +611,7 @@ the cells which are selected both horizontally and vertically are asserted.
Specifying no flags from a class is like specifying all flags from this class.
For example, "\fBSync\fR\ \fBPull\fR\ \fBNew\fR\ \fBFlags\fR" will propagate
new messages and flag changes from the far side to the near side,
"\fBSync\fR\ \fBNew\fR\ \fBDelete\fR" will propagate message arrivals and
"\fBSync\fR\ \fBNew\fR\ \fBGone\fR" will propagate message arrivals and
deletions both ways, and "\fBSync\fR\ \fBPush\fR" will propagate all changes
from the near side to the far side.
.br
@ -620,13 +620,13 @@ compound flag immediately asserts a cell in the matrix. In addition to at least
one compound flag, the individual flags can be used as well, but as opposed to
the first style, they immediately assert all cells in their respective
row/column. For example,
"\fBSync\fR\ \fBPullNew\fR\ \fBPullDelete\fR\ \fBPush\fR" will propagate
"\fBSync\fR\ \fBPullNew\fR\ \fBPullGone\fR\ \fBPush\fR" will propagate
message arrivals and deletions from the far side to the near side and any
changes from the near side to the far side.
.br
Note that it is not allowed to assert a cell in two ways, e.g.
"\fBSync\fR\ \fBPullNew\fR\ \fBPull\fR" and
"\fBSync\fR\ \fBPullNew\fR\ \fBDelete\fR\ \fBPush\fR" induce error messages.
"\fBSync\fR\ \fBPullNew\fR\ \fBGone\fR\ \fBPush\fR" induce error messages.
.br
\fBNone\fR may not be combined with any other operation.
.
@ -766,7 +766,7 @@ Make sure your IMAP server does not auto-expunge deleted messages - it is
slow, and semantically somewhat questionable. Specifically, Gmail needs to
be configured not to do it.
.P
By default, \fBmbsync\fR will not delete any messages - deletions are
By default, \fBmbsync\fR will not delete any messages - expunges are
propagated by marking the messages as deleted in the opposite Store.
Once you have verified that your setup works, you will typically want to
set \fBExpunge\fR to \fBBoth\fR, so that deletions become effective.

View File

@ -1051,7 +1051,7 @@ my @X05 = (
);
test("flags", \@x01, \@X05, \@O05);
my @O06 = ("", "", "Sync Delete\n");
my @O06 = ("", "", "Sync Gone\n");
my @X06 = (
I, 0, I,
P, "", "/", "",
@ -1059,7 +1059,7 @@ my @X06 = (
Q, "", "<", "",
I, "", "<", "+T",
);
test("deletions", \@x01, \@X06, \@O06);
test("gone", \@x01, \@X06, \@O06);
my @O07 = ("", "", "Sync New\n");
my @X07 = (
@ -1071,7 +1071,7 @@ my @X07 = (
);
test("new", \@x01, \@X07, \@O07);
my @O08 = ("", "", "Sync PushFlags PullDelete\n");
my @O08 = ("", "", "Sync PushFlags PullGone\n");
my @X08 = (
I, 0, I,
P, "", "/", "",
@ -1081,7 +1081,7 @@ my @X08 = (
Q, "", "<", "",
I, "", "<", "+T",
);
test("push flags + pull deletions", \@x01, \@X08, \@O08);
test("push flags + pull gone", \@x01, \@X08, \@O08);
my @O09 = ("", "", "Sync None\nExpunge Both\n");
my @X09 = (

View File

@ -752,7 +752,7 @@ box_opened2( sync_vars_t *svars, int t )
opts[t] |= OPEN_NEW | OPEN_FIND;
svars->state[t] |= ST_FIND_OLD;
}
if (chan->ops[t] & (OP_DELETE|OP_FLAGS)) {
if (chan->ops[t] & (OP_GONE | OP_FLAGS)) {
opts[t] |= OPEN_SETFLAGS;
opts[t^1] |= OPEN_OLD;
if (chan->ops[t] & OP_FLAGS)
@ -1112,7 +1112,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
// ... except for undeletion, as that's the opposite.
(!(srec->msg[t]->flags & F_DELETED) && (srec->flags & F_DELETED))))
notice( "Notice: conflicting changes in (%u,%u)\n", srec->uid[F], srec->uid[N] );
if (svars->chan->ops[t] & OP_DELETE) {
if (svars->chan->ops[t] & OP_GONE) {
debug( " %sing delete\n", str_hl[t] );
srec->aflags[t] = F_DELETED;
srec->status |= S_DELETE;

View File

@ -17,7 +17,7 @@
BIT_ENUM(
OP_NEW,
OP_UPGRADE,
OP_DELETE,
OP_GONE,
OP_FLAGS,
OP_EXPUNGE,
OP_CREATE,
@ -38,7 +38,7 @@ BIT_ENUM(
XOP_REMOVE_NOOP,
)
#define OP_MASK_TYPE (OP_NEW | OP_UPGRADE | OP_DELETE | OP_FLAGS) // Asserted in the target side ops
#define OP_MASK_TYPE (OP_NEW | OP_UPGRADE | OP_GONE | OP_FLAGS) // Asserted in the target side ops
#define XOP_MASK_DIR (XOP_PUSH | XOP_PULL)
DECL_BIT_FORMATTER_FUNCTION(ops, OP)