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
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.
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;
} else if (!strcasecmp( "Pull", arg )) {
*cops |= XOP_PULL;
} else if (!strcasecmp( "Upgrade", arg )) {
*cops |= OP_UPGRADE;
} else if (!strcasecmp( "ReNew", arg )) {
*cops |= OP_RENEW;
cfile->renew_warn = 1;
*cops |= OP_UPGRADE;
} else if (!strcasecmp( "New", arg )) {
*cops |= OP_NEW;
} else if (!strcasecmp( "Delete", arg )) {
*cops |= OP_DELETE;
} else if (!strcasecmp( "Flags", arg )) {
*cops |= OP_FLAGS;
} else if (!strcasecmp( "PullUpgrade", arg )) {
conf->ops[N] |= OP_UPGRADE;
} else if (!strcasecmp( "PullReNew", arg )) {
conf->ops[N] |= OP_RENEW;
cfile->renew_warn = 1;
conf->ops[N] |= OP_UPGRADE;
} else if (!strcasecmp( "PullNew", arg )) {
conf->ops[N] |= OP_NEW;
} else if (!strcasecmp( "PullDelete", arg )) {
conf->ops[N] |= OP_DELETE;
} else if (!strcasecmp( "PullFlags", arg )) {
conf->ops[N] |= OP_FLAGS;
} else if (!strcasecmp( "PushUpgrade", arg )) {
conf->ops[F] |= OP_UPGRADE;
} else if (!strcasecmp( "PushReNew", arg )) {
conf->ops[F] |= OP_RENEW;
cfile->renew_warn = 1;
conf->ops[F] |= OP_UPGRADE;
} else if (!strcasecmp( "PushNew", arg )) {
conf->ops[F] |= OP_NEW;
} else if (!strcasecmp( "PushDelete", arg )) {
@ -446,6 +455,7 @@ load_config( const char *where )
cfile.line = 0;
cfile.err = 0;
cfile.ms_warn = 0;
cfile.renew_warn = 0;
cfile.rest = NULL;
gcops = 0;
@ -617,6 +627,8 @@ load_config( const char *where )
fclose (cfile.fp);
if (cfile.ms_warn)
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, "" );
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;
int ms_warn, renew_warn;
int path_len;
char *cmd, *val, *rest;
} conffile_t;

View File

@ -37,7 +37,7 @@ PACKAGE " " VERSION " - mailbox synchronizer\n"
" -n, --new propagate new messages\n"
" -d, --delete propagate message deletions\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"
" -H, --push propagate from near to far side\n"
" -C, --create propagate creations of mailboxes\n"
@ -50,8 +50,8 @@ 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 --renew are specified, all are active.\n"
"Direction and operation can be concatenated like --pull-new, etc.\n"
"If neither --new, --delete, --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"
"\nSupported mailbox formats are: IMAP4rev1, Maildir\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;
int oind, cops = 0, op, ms_warn = 0, renew_warn = 0;
tzset();
gethostname( Hostname, sizeof(Hostname) );
@ -274,8 +274,11 @@ main( int argc, char **argv )
rlcac:
if (!strcmp( opt, "new" )) {
op |= OP_NEW;
} else if (!strcmp( opt, "upgrade" )) {
op |= OP_UPGRADE;
} else if (!strcmp( opt, "renew" )) {
op |= OP_RENEW;
renew_warn = 1;
op |= OP_UPGRADE;
} else if (!strcmp( opt, "delete" )) {
op |= OP_DELETE;
} else if (!strcmp( opt, "flags" )) {
@ -351,6 +354,7 @@ main( int argc, char **argv )
case 'd':
case 'f':
case 'N':
case 'u':
--ochar;
op = 0;
cac:
@ -361,8 +365,10 @@ main( int argc, char **argv )
op |= OP_DELETE;
else if (*ochar == 'f')
op |= OP_FLAGS;
else if (*ochar == 'u')
op |= OP_UPGRADE;
else if (*ochar == 'N')
op |= OP_RENEW;
op |= OP_UPGRADE, renew_warn = 1;
else
break;
}
@ -467,6 +473,8 @@ main( int argc, char **argv )
}
if (ms_warn)
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) {
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-N\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-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}
.TP
\r{\fB-L\fR|\fB-H\fR}[\fBn\fR][\fBN\fR][\fBd\fR][\fBf\fR],\
{\fB--pull\fR|\fB--push\fR}[\fB-new\fR|\fB-renew\fR|\fB-delete\fR|\fB-flags\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-upgrade\fR|\fB-delete\fR|\fB-flags\fR]
Override any \fBSync\fR options from the config file. See below.
.TP
\fB-h\fR, \fB--help\fR
@ -164,7 +164,7 @@ propagated into this Store.
This is useful for avoiding downloading messages with large attachments
unless they are actually needed.
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
typically the case for servers) is not recommended, as you may never
notice that affected messages were not propagated to it.
@ -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] [\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:
.br
\fBPull\fR - propagate changes from far to near side.
@ -583,7 +583,7 @@ Select the synchronization operation(s) to perform:
.br
\fBNew\fR - propagate newly appeared messages.
.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.
.br
\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.
Useful if you want to expunge only.
.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
two-dimensional matrix (a table). Its cells are the individual actions to
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_msg[] =
"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[] =
"%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_new[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) {
if (srec->status & S_DEAD)
continue;
@ -758,11 +758,11 @@ box_opened2( sync_vars_t *svars, int t )
if (chan->ops[t] & OP_FLAGS)
opts[t^1] |= OPEN_FLAGS;
}
if (!any_dummies[t] && (chan->ops[t] & OP_RENEW)) {
chan->ops[t] &= ~OP_RENEW;
debug( "no %s dummies; masking ReNew\n", str_fn[t] );
if (!any_dummies[t] && (chan->ops[t] & OP_UPGRADE)) {
chan->ops[t] &= ~OP_UPGRADE;
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;
if ((chan->ops[t] & OP_NEW) || 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)
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] );
if (chan->ops[t] & OP_RENEW)
if (chan->ops[t] & OP_UPGRADE)
opts[t] |= OPEN_OLD | OPEN_FLAGS | OPEN_SETFLAGS;
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.
// 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.
// OP_RENEW makes sense only for legacy S_SKIPPED entries.
if ((chan->ops[N] & (OP_NEW|OP_RENEW|OP_FLAGS)) && chan->max_messages)
// OP_UPGRADE makes sense only for legacy S_SKIPPED entries.
if ((chan->ops[N] & (OP_NEW | OP_UPGRADE | OP_FLAGS)) && chan->max_messages)
svars->any_expiring = 1;
if (svars->any_expiring) {
opts[N] |= OPEN_OLD | OPEN_FLAGS;
if (any_dummies[N])
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;
}
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.
// 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.
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;
if (sflags & F_FLAGGED) {
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) {
// 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;
// The message size was not queried, so this won't be dummified below.
srec->status = S_PENDING | S_DUMMY(t);

View File

@ -16,7 +16,7 @@
BIT_ENUM(
OP_NEW,
OP_RENEW,
OP_UPGRADE,
OP_DELETE,
OP_FLAGS,
OP_EXPUNGE,
@ -38,7 +38,7 @@ BIT_ENUM(
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)
DECL_BIT_FORMATTER_FUNCTION(ops, OP)