rename ReNew to Upgrade

that's what it really has been for a while now.
This commit is contained in:
Oswald Buddenhagen 2022-01-12 12:49:17 +01:00
parent 8f39d06015
commit 6308a7f41b
7 changed files with 55 additions and 33 deletions

2
NEWS
View File

@ -9,6 +9,8 @@ is now the file's containing directory.
Placeholders will be now created for messages exceeding MaxSize even if Placeholders will be now created for messages exceeding MaxSize even if
they are flagged on the source side. they are flagged on the source side.
Renamed the ReNew/--renew/-N options to Upgrade/--upgrade/-u.
MaxMessages and MaxSize can be used together now. MaxMessages and MaxSize can be used together now.
The unfiltered list of mailboxes in each Store can be printed now. The unfiltered list of mailboxes in each Store can be printed now.

View File

@ -191,24 +191,33 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf )
*cops |= XOP_PUSH; *cops |= XOP_PUSH;
} else if (!strcasecmp( "Pull", arg )) { } else if (!strcasecmp( "Pull", arg )) {
*cops |= XOP_PULL; *cops |= XOP_PULL;
} else if (!strcasecmp( "Upgrade", arg )) {
*cops |= OP_UPGRADE;
} else if (!strcasecmp( "ReNew", arg )) { } else if (!strcasecmp( "ReNew", arg )) {
*cops |= OP_RENEW; cfile->renew_warn = 1;
*cops |= OP_UPGRADE;
} else if (!strcasecmp( "New", arg )) { } else if (!strcasecmp( "New", arg )) {
*cops |= OP_NEW; *cops |= OP_NEW;
} else if (!strcasecmp( "Delete", arg )) { } else if (!strcasecmp( "Delete", arg )) {
*cops |= OP_DELETE; *cops |= OP_DELETE;
} else if (!strcasecmp( "Flags", arg )) { } else if (!strcasecmp( "Flags", arg )) {
*cops |= OP_FLAGS; *cops |= OP_FLAGS;
} else if (!strcasecmp( "PullUpgrade", arg )) {
conf->ops[N] |= OP_UPGRADE;
} else if (!strcasecmp( "PullReNew", arg )) { } else if (!strcasecmp( "PullReNew", arg )) {
conf->ops[N] |= OP_RENEW; cfile->renew_warn = 1;
conf->ops[N] |= OP_UPGRADE;
} else if (!strcasecmp( "PullNew", arg )) { } else if (!strcasecmp( "PullNew", arg )) {
conf->ops[N] |= OP_NEW; conf->ops[N] |= OP_NEW;
} else if (!strcasecmp( "PullDelete", arg )) { } else if (!strcasecmp( "PullDelete", arg )) {
conf->ops[N] |= OP_DELETE; conf->ops[N] |= OP_DELETE;
} else if (!strcasecmp( "PullFlags", arg )) { } else if (!strcasecmp( "PullFlags", arg )) {
conf->ops[N] |= OP_FLAGS; conf->ops[N] |= OP_FLAGS;
} else if (!strcasecmp( "PushUpgrade", arg )) {
conf->ops[F] |= OP_UPGRADE;
} else if (!strcasecmp( "PushReNew", arg )) { } else if (!strcasecmp( "PushReNew", arg )) {
conf->ops[F] |= OP_RENEW; cfile->renew_warn = 1;
conf->ops[F] |= OP_UPGRADE;
} else if (!strcasecmp( "PushNew", arg )) { } else if (!strcasecmp( "PushNew", arg )) {
conf->ops[F] |= OP_NEW; conf->ops[F] |= OP_NEW;
} else if (!strcasecmp( "PushDelete", arg )) { } else if (!strcasecmp( "PushDelete", arg )) {
@ -446,6 +455,7 @@ load_config( const char *where )
cfile.line = 0; cfile.line = 0;
cfile.err = 0; cfile.err = 0;
cfile.ms_warn = 0; cfile.ms_warn = 0;
cfile.renew_warn = 0;
cfile.rest = NULL; cfile.rest = NULL;
gcops = 0; gcops = 0;
@ -617,6 +627,8 @@ load_config( const char *where )
fclose (cfile.fp); fclose (cfile.fp);
if (cfile.ms_warn) if (cfile.ms_warn)
warn( "Notice: Master/Slave are deprecated; use Far/Near instead.\n" ); warn( "Notice: Master/Slave are deprecated; use Far/Near instead.\n" );
if (cfile.renew_warn)
warn( "Notice: ReNew is deprecated; use Upgrade instead.\n" );
cfile.err |= merge_ops( gcops, global_conf.ops, "" ); cfile.err |= merge_ops( gcops, global_conf.ops, "" );
if (!global_conf.sync_state) { if (!global_conf.sync_state) {
const char *state_home = getenv( "XDG_STATE_HOME" ); const char *state_home = getenv( "XDG_STATE_HOME" );

View File

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

View File

@ -37,7 +37,7 @@ PACKAGE " " VERSION " - mailbox synchronizer\n"
" -n, --new propagate new messages\n" " -n, --new propagate new messages\n"
" -d, --delete propagate message deletions\n" " -d, --delete propagate message deletions\n"
" -f, --flags propagate message flag changes\n" " -f, --flags propagate message flag changes\n"
" -N, --renew propagate previously not propagated new messages\n" " -u, --upgrade upgrade placeholders to full messages\n"
" -L, --pull propagate from far to near side\n" " -L, --pull propagate from far to near side\n"
" -H, --push propagate from near to far side\n" " -H, --push propagate from near to far side\n"
" -C, --create propagate creations of mailboxes\n" " -C, --create propagate creations of mailboxes\n"
@ -50,8 +50,8 @@ PACKAGE " " VERSION " - mailbox synchronizer\n"
" -v, --version display version\n" " -v, --version display version\n"
" -h, --help display this help message\n" " -h, --help display this help message\n"
"\nIf neither --pull nor --push are specified, both are active.\n" "\nIf neither --pull nor --push are specified, both are active.\n"
"If neither --new, --delete, --flags nor --renew are specified, all are active.\n" "If neither --new, --delete, --flags, nor --upgrade are specified, all are\n"
"Direction and operation can be concatenated like --pull-new, etc.\n" "active. Direction and operation can be concatenated like --pull-new, etc.\n"
"--create, --remove, and --expunge can be suffixed with -far/-near.\n" "--create, --remove, and --expunge can be suffixed with -far/-near.\n"
"See the man page for details.\n" "See the man page for details.\n"
"\nSupported mailbox formats are: IMAP4rev1, Maildir\n" "\nSupported mailbox formats are: IMAP4rev1, Maildir\n"
@ -144,7 +144,7 @@ main( int argc, char **argv )
{ {
core_vars_t mvars[1]; core_vars_t mvars[1];
char *config = NULL, *opt, *ochar; char *config = NULL, *opt, *ochar;
int oind, cops = 0, op, ms_warn = 0; int oind, cops = 0, op, ms_warn = 0, renew_warn = 0;
tzset(); tzset();
gethostname( Hostname, sizeof(Hostname) ); gethostname( Hostname, sizeof(Hostname) );
@ -274,8 +274,11 @@ main( int argc, char **argv )
rlcac: rlcac:
if (!strcmp( opt, "new" )) { if (!strcmp( opt, "new" )) {
op |= OP_NEW; op |= OP_NEW;
} else if (!strcmp( opt, "upgrade" )) {
op |= OP_UPGRADE;
} else if (!strcmp( opt, "renew" )) { } else if (!strcmp( opt, "renew" )) {
op |= OP_RENEW; renew_warn = 1;
op |= OP_UPGRADE;
} else if (!strcmp( opt, "delete" )) { } else if (!strcmp( opt, "delete" )) {
op |= OP_DELETE; op |= OP_DELETE;
} else if (!strcmp( opt, "flags" )) { } else if (!strcmp( opt, "flags" )) {
@ -351,6 +354,7 @@ main( int argc, char **argv )
case 'd': case 'd':
case 'f': case 'f':
case 'N': case 'N':
case 'u':
--ochar; --ochar;
op = 0; op = 0;
cac: cac:
@ -361,8 +365,10 @@ main( int argc, char **argv )
op |= OP_DELETE; op |= OP_DELETE;
else if (*ochar == 'f') else if (*ochar == 'f')
op |= OP_FLAGS; op |= OP_FLAGS;
else if (*ochar == 'u')
op |= OP_UPGRADE;
else if (*ochar == 'N') else if (*ochar == 'N')
op |= OP_RENEW; op |= OP_UPGRADE, renew_warn = 1;
else else
break; break;
} }
@ -467,6 +473,8 @@ main( int argc, char **argv )
} }
if (ms_warn) if (ms_warn)
warn( "Notice: -master/-slave/m/s suffixes are deprecated; use -far/-near/f/n instead.\n" ); 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 (DFlags & DEBUG_ANY) { if (DFlags & DEBUG_ANY) {
Verbosity = VERBOSE; 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] \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. Override any \fBExpunge\fR options from the config file. See below.
.TP .TP
{\fB-n\fR|\fB-N\fR|\fB-d\fR|\fB-f\fR|\fB-0\fR|\fB-F\fR},\ {\fB-n\fR|\fB-u\fR|\fB-d\fR|\fB-f\fR|\fB-0\fR|\fB-F\fR},\
{\fB--new\fR|\fB--renew\fR|\fB--delete\fR|\fB--flags\fR|\fB--noop\fR|\fB--full\fR} {\fB--new\fR|\fB--upgrade\fR|\fB--delete\fR|\fB--flags\fR|\fB--noop\fR|\fB--full\fR}
.TP .TP
\r{\fB-L\fR|\fB-H\fR}[\fBn\fR][\fBN\fR][\fBd\fR][\fBf\fR],\ \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-renew\fR|\fB-delete\fR|\fB-flags\fR] {\fB--pull\fR|\fB--push\fR}[\fB-new\fR|\fB-upgrade\fR|\fB-delete\fR|\fB-flags\fR]
Override any \fBSync\fR options from the config file. See below. Override any \fBSync\fR options from the config file. See below.
.TP .TP
\fB-h\fR, \fB--help\fR \fB-h\fR, \fB--help\fR
@ -164,7 +164,7 @@ propagated into this Store.
This is useful for avoiding downloading messages with large attachments This is useful for avoiding downloading messages with large attachments
unless they are actually needed. unless they are actually needed.
To upgrade the placeholder to the full message, it must be flagged, and To upgrade the placeholder to the full message, it must be flagged, and
the \fBReNew\fR operation executed. the \fBUpgrade\fR operation executed.
Caveats: Setting a size limit on a Store you never read directly (which is Caveats: Setting a size limit on a Store you never read directly (which is
typically the case for servers) is not recommended, as you may never typically the case for servers) is not recommended, as you may never
notice that affected messages were not propagated to it. notice that affected messages were not propagated to it.
@ -574,7 +574,7 @@ case you need to enable this option.
(Global default: \fBno\fR). (Global default: \fBno\fR).
. .
.TP .TP
\fBSync\fR {\fBNone\fR|[\fBPull\fR] [\fBPush\fR] [\fBNew\fR] [\fBReNew\fR] [\fBDelete\fR] [\fBFlags\fR]|\fBAll\fR} \fBSync\fR {\fBNone\fR|[\fBPull\fR] [\fBPush\fR] [\fBNew\fR] [\fBUpgrade\fR] [\fBDelete\fR] [\fBFlags\fR]|\fBAll\fR}
Select the synchronization operation(s) to perform: Select the synchronization operation(s) to perform:
.br .br
\fBPull\fR - propagate changes from far to near side. \fBPull\fR - propagate changes from far to near side.
@ -583,7 +583,7 @@ Select the synchronization operation(s) to perform:
.br .br
\fBNew\fR - propagate newly appeared messages. \fBNew\fR - propagate newly appeared messages.
.br .br
\fBReNew\fR - upgrade placeholders to full messages. Useful only with \fBUpgrade\fR - upgrade placeholders to full messages. Useful only with
a configured \fBMaxSize\fR. a configured \fBMaxSize\fR.
.br .br
\fBDelete\fR - propagate message deletions. This applies only to messages that \fBDelete\fR - propagate message deletions. This applies only to messages that
@ -601,7 +601,7 @@ This is the global default.
\fBNone\fR (\fB--noop\fR on the command line) - don't propagate anything. \fBNone\fR (\fB--noop\fR on the command line) - don't propagate anything.
Useful if you want to expunge only. Useful if you want to expunge only.
.IP .IP
\fBPull\fR and \fBPush\fR are direction flags, while \fBNew\fR, \fBReNew\fR, \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 \fBDelete\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 two-dimensional matrix (a table). Its cells are the individual actions to
perform. There are two styles of asserting the cells: perform. There are two styles of asserting the cells:

View File

@ -208,7 +208,7 @@ copy_msg_convert( int in_cr, int out_cr, copy_vars_t *vars, int t )
static const char dummy_subj[] = "Subject: [placeholder] (No Subject)"; static const char dummy_subj[] = "Subject: [placeholder] (No Subject)";
static const char dummy_msg[] = static const char dummy_msg[] =
"Having a size of %s, this message is over the MaxSize limit.%s" "Having a size of %s, this message is over the MaxSize limit.%s"
"Flag it and sync again (Sync mode ReNew) to fetch its real contents.%s"; "Flag it and sync again (Sync mode Upgrade) to fetch its real contents.%s";
static const char dummy_flag[] = static const char dummy_flag[] =
"%s" "%s"
"The original message is flagged as important.%s"; "The original message is flagged as important.%s";
@ -711,7 +711,7 @@ box_opened2( sync_vars_t *svars, int t )
int any_upgrades[2] = { 0, 0 }; int any_upgrades[2] = { 0, 0 };
int any_new[2] = { 0, 0 }; int any_new[2] = { 0, 0 };
int any_tuids[2] = { 0, 0 }; int any_tuids[2] = { 0, 0 };
if (svars->replayed || ((chan->ops[F] | chan->ops[N]) & OP_RENEW)) { if (svars->replayed || ((chan->ops[F] | chan->ops[N]) & OP_UPGRADE)) {
for (srec = svars->srecs; srec; srec = srec->next) { for (srec = svars->srecs; srec; srec = srec->next) {
if (srec->status & S_DEAD) if (srec->status & S_DEAD)
continue; continue;
@ -758,11 +758,11 @@ box_opened2( sync_vars_t *svars, int t )
if (chan->ops[t] & OP_FLAGS) if (chan->ops[t] & OP_FLAGS)
opts[t^1] |= OPEN_FLAGS; opts[t^1] |= OPEN_FLAGS;
} }
if (!any_dummies[t] && (chan->ops[t] & OP_RENEW)) { if (!any_dummies[t] && (chan->ops[t] & OP_UPGRADE)) {
chan->ops[t] &= ~OP_RENEW; chan->ops[t] &= ~OP_UPGRADE;
debug( "no %s dummies; masking ReNew\n", str_fn[t] ); debug( "no %s dummies; masking Upgrade\n", str_fn[t] );
} }
if ((chan->ops[t] & (OP_NEW | OP_RENEW)) || any_new[t] || any_upgrades[t]) { if ((chan->ops[t] & (OP_NEW | OP_UPGRADE)) || any_new[t] || any_upgrades[t]) {
opts[t] |= OPEN_APPEND; opts[t] |= OPEN_APPEND;
if ((chan->ops[t] & OP_NEW) || any_new[t]) { if ((chan->ops[t] & OP_NEW) || any_new[t]) {
debug( "resuming %s of %d new message(s)\n", str_hl[t], any_new[t] ); debug( "resuming %s of %d new message(s)\n", str_hl[t], any_new[t] );
@ -770,9 +770,9 @@ box_opened2( sync_vars_t *svars, int t )
if (chan->stores[t]->max_size != UINT_MAX) if (chan->stores[t]->max_size != UINT_MAX)
opts[t^1] |= OPEN_NEW_SIZE; opts[t^1] |= OPEN_NEW_SIZE;
} }
if ((chan->ops[t] & OP_RENEW) || any_upgrades[t]) { if ((chan->ops[t] & OP_UPGRADE) || any_upgrades[t]) {
debug( "resuming %s of %d upgrade(s)\n", str_hl[t], any_upgrades[t] ); debug( "resuming %s of %d upgrade(s)\n", str_hl[t], any_upgrades[t] );
if (chan->ops[t] & OP_RENEW) if (chan->ops[t] & OP_UPGRADE)
opts[t] |= OPEN_OLD | OPEN_FLAGS | OPEN_SETFLAGS; opts[t] |= OPEN_OLD | OPEN_FLAGS | OPEN_SETFLAGS;
opts[t^1] |= OPEN_OLD; opts[t^1] |= OPEN_OLD;
} }
@ -794,14 +794,14 @@ box_opened2( sync_vars_t *svars, int t )
// updating flags can cause expiration of already overdue messages. // updating flags can cause expiration of already overdue messages.
// The latter would also apply when the expired box is the source, // The latter would also apply when the expired box is the source,
// but it's more natural to treat it as read-only in that case. // but it's more natural to treat it as read-only in that case.
// OP_RENEW makes sense only for legacy S_SKIPPED entries. // OP_UPGRADE makes sense only for legacy S_SKIPPED entries.
if ((chan->ops[N] & (OP_NEW|OP_RENEW|OP_FLAGS)) && chan->max_messages) if ((chan->ops[N] & (OP_NEW | OP_UPGRADE | OP_FLAGS)) && chan->max_messages)
svars->any_expiring = 1; svars->any_expiring = 1;
if (svars->any_expiring) { if (svars->any_expiring) {
opts[N] |= OPEN_OLD | OPEN_FLAGS; opts[N] |= OPEN_OLD | OPEN_FLAGS;
if (any_dummies[N]) if (any_dummies[N])
opts[F] |= OPEN_OLD | OPEN_FLAGS; opts[F] |= OPEN_OLD | OPEN_FLAGS;
else if (chan->ops[N] & (OP_NEW | OP_RENEW)) else if (chan->ops[N] & (OP_NEW | OP_UPGRADE))
opts[F] |= OPEN_FLAGS; opts[F] |= OPEN_FLAGS;
} }
svars->opts[F] = svars->drv[F]->prepare_load_box( ctx[F], opts[F] ); svars->opts[F] = svars->drv[F]->prepare_load_box( ctx[F], opts[F] );
@ -1053,7 +1053,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
// Flagging the message on the target side causes an upgrade of the dummy. // Flagging the message on the target side causes an upgrade of the dummy.
// We do this first in a separate loop, so flag propagation sees the upgraded // We do this first in a separate loop, so flag propagation sees the upgraded
// state for both sides. After a journal replay, that would be the case anyway. // state for both sides. After a journal replay, that would be the case anyway.
if ((svars->chan->ops[t] & OP_RENEW) && (srec->status & S_DUMMY(t)) && srec->uid[t^1] && srec->msg[t]) { if ((svars->chan->ops[t] & OP_UPGRADE) && (srec->status & S_DUMMY(t)) && srec->uid[t^1] && srec->msg[t]) {
sflags = srec->msg[t]->flags; sflags = srec->msg[t]->flags;
if (sflags & F_FLAGGED) { if (sflags & F_FLAGGED) {
sflags &= ~(F_SEEN | F_FLAGGED) | (srec->flags & F_SEEN); // As below. sflags &= ~(F_SEEN | F_FLAGGED) | (srec->flags & F_SEEN); // As below.
@ -1183,7 +1183,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
if (srec->status & S_SKIPPED) { if (srec->status & S_SKIPPED) {
// Pre-1.4 legacy only: The message was skipped due to being too big. // Pre-1.4 legacy only: The message was skipped due to being too big.
if (!(svars->chan->ops[t] & OP_RENEW)) if (!(svars->chan->ops[t] & OP_UPGRADE))
continue; continue;
// The message size was not queried, so this won't be dummified below. // The message size was not queried, so this won't be dummified below.
srec->status = S_PENDING | S_DUMMY(t); srec->status = S_PENDING | S_DUMMY(t);

View File

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