include expunges in progress counters
This commit is contained in:
parent
8fbc4323f4
commit
edc901b7af
1
NEWS
1
NEWS
|
@ -19,6 +19,7 @@ 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.
|
||||||
|
|
||||||
A proper summary is now printed prior to exiting.
|
A proper summary is now printed prior to exiting.
|
||||||
|
This includes expunges, which are now included in the progress as well.
|
||||||
|
|
||||||
Added new sync operation 'Old'.
|
Added new sync operation 'Old'.
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#define nz(a, b) ((a) ? (a) : (b))
|
#define nz(a, b) ((a) ? (a) : (b))
|
||||||
|
|
||||||
static int ops_any[2], trash_any[2];
|
static int ops_any[2], trash_any[2], expunge_any[2];
|
||||||
static int chans_total, chans_done;
|
static int chans_total, chans_done;
|
||||||
static int boxes_total, boxes_done;
|
static int boxes_total, boxes_done;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ static wakeup_t stats_wakeup;
|
||||||
static void
|
static void
|
||||||
print_stats( void )
|
print_stats( void )
|
||||||
{
|
{
|
||||||
char buf[3][64];
|
char buf[3][80];
|
||||||
char *cs;
|
char *cs;
|
||||||
static int cols = -1;
|
static int cols = -1;
|
||||||
|
|
||||||
|
@ -29,10 +29,11 @@ print_stats( void )
|
||||||
int ll = sprintf( buf[2], "C: %d/%d B: %d/%d", chans_done, chans_total, boxes_done, boxes_total );
|
int ll = sprintf( buf[2], "C: %d/%d B: %d/%d", chans_done, chans_total, boxes_done, boxes_total );
|
||||||
int cls = (cols - ll - 10) / 2;
|
int cls = (cols - ll - 10) / 2;
|
||||||
for (int t = 0; t < 2; t++) {
|
for (int t = 0; t < 2; t++) {
|
||||||
int l = sprintf( buf[t], "+%d/%d *%d/%d #%d/%d",
|
int l = sprintf( buf[t], "+%d/%d *%d/%d #%d/%d -%d/%d",
|
||||||
new_done[t], new_total[t],
|
new_done[t], new_total[t],
|
||||||
flags_done[t], flags_total[t],
|
flags_done[t], flags_total[t],
|
||||||
trash_done[t], trash_total[t] );
|
trash_done[t], trash_total[t],
|
||||||
|
expunge_done[t], expunge_total[t] );
|
||||||
if (l > cls)
|
if (l > cls)
|
||||||
buf[t][cls - 1] = '~';
|
buf[t][cls - 1] = '~';
|
||||||
}
|
}
|
||||||
|
@ -91,6 +92,11 @@ summary( void )
|
||||||
",\nwould move %d %s message(s) to trash" :
|
",\nwould move %d %s message(s) to trash" :
|
||||||
",\nmoved %d %s message(s) to trash",
|
",\nmoved %d %s message(s) to trash",
|
||||||
trash_done[t], str_fn[t] );
|
trash_done[t], str_fn[t] );
|
||||||
|
if (expunge_any[t])
|
||||||
|
printf( (DFlags & DRYRUN) ?
|
||||||
|
",\nwould expunge %d message(s) from %s" :
|
||||||
|
",\nexpunged %d message(s) from %s",
|
||||||
|
expunge_done[t], str_fn[t] );
|
||||||
}
|
}
|
||||||
puts( "." );
|
puts( "." );
|
||||||
}
|
}
|
||||||
|
@ -235,11 +241,13 @@ add_channel( chan_ent_t ***chanapp, channel_conf_t *chan, int ops[] )
|
||||||
}
|
}
|
||||||
if (chan->ops[t] & OP_MASK_TYPE)
|
if (chan->ops[t] & OP_MASK_TYPE)
|
||||||
ops_any[t] = 1;
|
ops_any[t] = 1;
|
||||||
if ((chan->ops[t] & (OP_EXPUNGE | OP_EXPUNGE_SOLO)) &&
|
if (chan->ops[t] & (OP_EXPUNGE | OP_EXPUNGE_SOLO)) {
|
||||||
(chan->stores[t]->trash ||
|
expunge_any[t] = 1;
|
||||||
(chan->stores[t^1]->trash && chan->stores[t^1]->trash_remote_new)))
|
if (chan->stores[t]->trash ||
|
||||||
|
(chan->stores[t^1]->trash && chan->stores[t^1]->trash_remote_new))
|
||||||
trash_any[t] = 1;
|
trash_any[t] = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
**chanapp = ce;
|
**chanapp = ce;
|
||||||
*chanapp = &ce->next;
|
*chanapp = &ce->next;
|
||||||
|
|
|
@ -779,13 +779,13 @@ If \fBmbsync\fR's output is connected to a console, it will print progress
|
||||||
counters by default. The output will look like this:
|
counters by default. The output will look like this:
|
||||||
.P
|
.P
|
||||||
.in +4
|
.in +4
|
||||||
C: 1/2 B: 3/4 F: +13/13 *23/42 #0/0 N: +0/7 *0/0 #0/0
|
C: 1/2 B: 3/4 F: +13/13 *23/42 #0/0 -0/0 N: +0/7 *0/0 #0/0 -0/0
|
||||||
.in -4
|
.in -4
|
||||||
.P
|
.P
|
||||||
This represents the cumulative progress over Channels, boxes, and messages
|
This represents the cumulative progress over Channels, boxes, and messages
|
||||||
affected on the far and near side, respectively.
|
affected on the far and near side, respectively.
|
||||||
The message counts represent added messages, messages with updated flags,
|
The message counts represent added messages, messages with updated flags,
|
||||||
and trashed messages, respectively.
|
trashed messages, and expunged messages, respectively.
|
||||||
No attempt is made to calculate the totals in advance, so they grow over
|
No attempt is made to calculate the totals in advance, so they grow over
|
||||||
time as more information is gathered.
|
time as more information is gathered.
|
||||||
.P
|
.P
|
||||||
|
|
29
src/sync.c
29
src/sync.c
|
@ -17,6 +17,7 @@ uint BufferLimit = 10 * 1024 * 1024;
|
||||||
int new_total[2], new_done[2];
|
int new_total[2], new_done[2];
|
||||||
int flags_total[2], flags_done[2];
|
int flags_total[2], flags_done[2];
|
||||||
int trash_total[2], trash_done[2];
|
int trash_total[2], trash_done[2];
|
||||||
|
int expunge_total[2], expunge_done[2];
|
||||||
|
|
||||||
static void sync_ref( sync_vars_t *svars ) { ++svars->ref_count; }
|
static void sync_ref( sync_vars_t *svars ) { ++svars->ref_count; }
|
||||||
static void sync_deref( sync_vars_t *svars );
|
static void sync_deref( sync_vars_t *svars );
|
||||||
|
@ -286,6 +287,10 @@ message_expunged( message_t *msg, void *aux )
|
||||||
msg->srec->msg[t] = NULL;
|
msg->srec->msg[t] = NULL;
|
||||||
msg->srec = NULL;
|
msg->srec = NULL;
|
||||||
}
|
}
|
||||||
|
if (msg->status & M_EXPUNGE) {
|
||||||
|
expunge_done[t]++;
|
||||||
|
stats();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void box_confirmed( int sts, uint uidvalidity, void *aux );
|
static void box_confirmed( int sts, uint uidvalidity, void *aux );
|
||||||
|
@ -1771,6 +1776,25 @@ sync_close( sync_vars_t *svars, int t )
|
||||||
|
|
||||||
if ((svars->chan->ops[t] & (OP_EXPUNGE | OP_EXPUNGE_SOLO)) && !(DFlags & FAKEEXPUNGE)
|
if ((svars->chan->ops[t] & (OP_EXPUNGE | OP_EXPUNGE_SOLO)) && !(DFlags & FAKEEXPUNGE)
|
||||||
/*&& !(svars->state[t] & ST_TRASH_BAD)*/) {
|
/*&& !(svars->state[t] & ST_TRASH_BAD)*/) {
|
||||||
|
if (Verbosity >= TERSE) {
|
||||||
|
if (svars->opts[t] & OPEN_UID_EXPUNGE) {
|
||||||
|
for (message_t *tmsg = svars->msgs[t]; tmsg; tmsg = tmsg->next) {
|
||||||
|
if (tmsg->status & M_DEAD)
|
||||||
|
continue;
|
||||||
|
if (tmsg->status & M_EXPUNGE)
|
||||||
|
expunge_total[t]++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (sync_rec_t *srec = svars->srecs; srec; srec = srec->next) {
|
||||||
|
if (srec->status & S_DEAD)
|
||||||
|
continue;
|
||||||
|
if (srec->status & S_DEL(t))
|
||||||
|
expunge_total[t]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stats();
|
||||||
|
}
|
||||||
|
|
||||||
debug( "expunging %s\n", str_fn[t] );
|
debug( "expunging %s\n", str_fn[t] );
|
||||||
svars->drv[t]->close_box( svars->ctx[t], box_closed, AUX );
|
svars->drv[t]->close_box( svars->ctx[t], box_closed, AUX );
|
||||||
} else {
|
} else {
|
||||||
|
@ -1792,10 +1816,13 @@ box_closed( int sts, int reported, void *aux )
|
||||||
// by a refresh, and in the extremely unlikely case of this happening
|
// by a refresh, and in the extremely unlikely case of this happening
|
||||||
// on both sides, we'd even get a duplicate. That's why this is only
|
// on both sides, we'd even get a duplicate. That's why this is only
|
||||||
// a fallback.
|
// a fallback.
|
||||||
if (srec->status & S_DEL(t))
|
if (srec->status & S_DEL(t)) {
|
||||||
srec->status |= S_GONE(t);
|
srec->status |= S_GONE(t);
|
||||||
|
expunge_done[t]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stats();
|
||||||
|
}
|
||||||
box_closed_p2( svars, t );
|
box_closed_p2( svars, t );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ extern uint BufferLimit;
|
||||||
extern int new_total[2], new_done[2];
|
extern int new_total[2], new_done[2];
|
||||||
extern int flags_total[2], flags_done[2];
|
extern int flags_total[2], flags_done[2];
|
||||||
extern int trash_total[2], trash_done[2];
|
extern int trash_total[2], trash_done[2];
|
||||||
|
extern int expunge_total[2], expunge_done[2];
|
||||||
|
|
||||||
extern const char *str_fn[2], *str_hl[2];
|
extern const char *str_fn[2], *str_hl[2];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user