format message flags in the sync debug output
now that we can do it cheaply, make copious use of it.
This commit is contained in:
parent
a49017f481
commit
c902f69c6f
14
src/driver.c
14
src/driver.c
|
@ -41,6 +41,20 @@ fmt_flags( uchar flags )
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag_str_t
|
||||||
|
fmt_lone_flags( uchar flags )
|
||||||
|
{
|
||||||
|
flag_str_t buf;
|
||||||
|
|
||||||
|
if (!flags) {
|
||||||
|
buf.str[0] = '-';
|
||||||
|
buf.str[1] = 0;
|
||||||
|
} else {
|
||||||
|
make_flags( flags, buf.str );
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
uint
|
uint
|
||||||
count_generic_messages( message_t *msgs )
|
count_generic_messages( message_t *msgs )
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,6 +48,7 @@ BIT_ENUM(
|
||||||
extern const char MsgFlags[F__NUM_BITS];
|
extern const char MsgFlags[F__NUM_BITS];
|
||||||
typedef struct { char str[F__NUM_BITS + 1]; } flag_str_t;
|
typedef struct { char str[F__NUM_BITS + 1]; } flag_str_t;
|
||||||
flag_str_t ATTR_OPTIMIZE /* force RVO */ fmt_flags( uchar flags );
|
flag_str_t ATTR_OPTIMIZE /* force RVO */ fmt_flags( uchar flags );
|
||||||
|
flag_str_t ATTR_OPTIMIZE /* force RVO */ fmt_lone_flags( uchar flags );
|
||||||
|
|
||||||
/* For message->status */
|
/* For message->status */
|
||||||
BIT_ENUM(
|
BIT_ENUM(
|
||||||
|
|
10
src/sync.c
10
src/sync.c
|
@ -1035,7 +1035,9 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
|
||||||
srec->pflags = ((srec->msg[t]->flags & ~(F_SEEN|F_FLAGGED)) | srec->aflags[t]) & ~srec->dflags[t];
|
srec->pflags = ((srec->msg[t]->flags & ~(F_SEEN|F_FLAGGED)) | srec->aflags[t]) & ~srec->dflags[t];
|
||||||
// Consequently, the srec's flags are committed right away as well.
|
// Consequently, the srec's flags are committed right away as well.
|
||||||
srec->flags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t];
|
srec->flags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t];
|
||||||
JLOG( "^ %u %u %u %u", (srec->uid[F], srec->uid[N], srec->pflags, srec->flags), "upgrading placeholder" );
|
JLOG( "^ %u %u %u %u", (srec->uid[F], srec->uid[N], srec->pflags, srec->flags),
|
||||||
|
"upgrading placeholder, dummy's flags %s, srec flags %s",
|
||||||
|
(fmt_lone_flags( srec->pflags ).str, fmt_lone_flags( srec->flags ).str) );
|
||||||
nsrec = upgrade_srec( svars, srec );
|
nsrec = upgrade_srec( svars, srec );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1360,7 +1362,8 @@ msg_copied( int sts, uint uid, copy_vars_t *vars )
|
||||||
case SYNC_OK:
|
case SYNC_OK:
|
||||||
if (!(srec->status & S_UPGRADE) && vars->msg->flags != srec->flags) {
|
if (!(srec->status & S_UPGRADE) && vars->msg->flags != srec->flags) {
|
||||||
srec->flags = vars->msg->flags;
|
srec->flags = vars->msg->flags;
|
||||||
JLOG( "* %u %u %u", (srec->uid[F], srec->uid[N], srec->flags), "%sed with flags", str_hl[t] );
|
JLOG( "* %u %u %u", (srec->uid[F], srec->uid[N], srec->flags),
|
||||||
|
"%sed with flags %s", (str_hl[t], fmt_lone_flags( srec->flags ).str) );
|
||||||
}
|
}
|
||||||
if (!uid) // Stored to a non-UIDPLUS mailbox
|
if (!uid) // Stored to a non-UIDPLUS mailbox
|
||||||
svars->state[t] |= ST_FIND_NEW;
|
svars->state[t] |= ST_FIND_NEW;
|
||||||
|
@ -1494,7 +1497,8 @@ flags_set_p2( sync_vars_t *svars, sync_rec_t *srec, int t )
|
||||||
} else {
|
} else {
|
||||||
uchar nflags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t];
|
uchar nflags = (srec->flags | srec->aflags[t]) & ~srec->dflags[t];
|
||||||
if (srec->flags != nflags) {
|
if (srec->flags != nflags) {
|
||||||
JLOG( "* %u %u %u", (srec->uid[F], srec->uid[N], nflags), "%sed flags; were %u", (str_hl[t], srec->flags) );
|
JLOG( "* %u %u %u", (srec->uid[F], srec->uid[N], nflags), "%sed flags %s; were %s",
|
||||||
|
(str_hl[t], fmt_lone_flags( nflags ).str, fmt_lone_flags( srec->flags ).str) );
|
||||||
srec->flags = nflags;
|
srec->flags = nflags;
|
||||||
}
|
}
|
||||||
if (t == N) {
|
if (t == N) {
|
||||||
|
|
|
@ -208,7 +208,7 @@ load_state( sync_vars_t *svars )
|
||||||
srec->status = S_SKIPPED;
|
srec->status = S_SKIPPED;
|
||||||
}
|
}
|
||||||
srec->flags = parse_flags( s );
|
srec->flags = parse_flags( s );
|
||||||
debug( " entry (%u,%u,%u,%s%s)\n", srec->uid[F], srec->uid[N], srec->flags,
|
debug( " entry (%u,%u,%s,%s%s)\n", srec->uid[F], srec->uid[N], fmt_flags( srec->flags ).str,
|
||||||
(srec->status & S_SKIPPED) ? "SKIP" : (srec->status & S_EXPIRED) ? "XPIRE" : "",
|
(srec->status & S_SKIPPED) ? "SKIP" : (srec->status & S_EXPIRED) ? "XPIRE" : "",
|
||||||
(srec->status & S_DUMMY(F)) ? ",F-DUMMY" : (srec->status & S_DUMMY(N)) ? ",N-DUMMY" : "" );
|
(srec->status & S_DUMMY(F)) ? ",F-DUMMY" : (srec->status & S_DUMMY(N)) ? ",N-DUMMY" : "" );
|
||||||
*svars->srecadd = srec;
|
*svars->srecadd = srec;
|
||||||
|
@ -372,8 +372,8 @@ load_state( sync_vars_t *svars )
|
||||||
assign_uid( svars, srec, N, t3 );
|
assign_uid( svars, srec, N, t3 );
|
||||||
break;
|
break;
|
||||||
case '*':
|
case '*':
|
||||||
debug( "flags now %u\n", t3 );
|
|
||||||
srec->flags = (uchar)t3;
|
srec->flags = (uchar)t3;
|
||||||
|
debug( "flags now %s\n", fmt_lone_flags( t3 ).str );
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
debug( "deleted dummy\n" );
|
debug( "deleted dummy\n" );
|
||||||
|
@ -391,9 +391,10 @@ load_state( sync_vars_t *svars )
|
||||||
srec->status = S_PENDING | (!srec->uid[F] ? S_DUMMY(F) : S_DUMMY(N));
|
srec->status = S_PENDING | (!srec->uid[F] ? S_DUMMY(F) : S_DUMMY(N));
|
||||||
break;
|
break;
|
||||||
case '^':
|
case '^':
|
||||||
debug( "is being upgraded, flags %u, srec flags %u\n", t3, t4 );
|
|
||||||
srec->pflags = (uchar)t3;
|
srec->pflags = (uchar)t3;
|
||||||
srec->flags = (uchar)t4;
|
srec->flags = (uchar)t4;
|
||||||
|
debug( "is being upgraded, dummy's flags %s, srec flags %s\n",
|
||||||
|
fmt_lone_flags( t3 ).str, fmt_lone_flags( t4 ).str );
|
||||||
srec = upgrade_srec( svars, srec );
|
srec = upgrade_srec( svars, srec );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user