Browse Source

add debug messages about effective requested operations

wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
950ebe833d
  1. 7
      src/common.h
  2. 9
      src/config.c
  3. 2
      src/main_sync.c
  4. 2
      src/sync.h

7
src/common.h

@ -217,6 +217,13 @@ void fmt_bits( uint bits, uint num_bits, const char *bit_str, const int *bit_off
BIT_FORMATTER_RET(name, pfx) \
BIT_FORMATTER_IMPL(name, pfx, static)
#define DECL_BIT_FORMATTER_FUNCTION(name, pfx) \
BIT_FORMATTER_RET(name, pfx) \
BIT_FORMATTER_PROTO(name, pfx, );
#define DEF_BIT_FORMATTER_FUNCTION(name, pfx) \
BIT_FORMATTER_IMPL(name, pfx, )
void *nfmalloc( size_t sz );
void *nfzalloc( size_t sz );
void *nfrealloc( void *mem, size_t sz );

9
src/config.c

@ -5,6 +5,8 @@
* mbsync - mailbox synchronizer
*/
#define DEBUG_FLAG DEBUG_MAIN
#include "config.h"
#include "sync.h"
@ -20,6 +22,8 @@ char FieldDelimiter = ';';
char FieldDelimiter = ':';
#endif
DEF_BIT_FORMATTER_FUNCTION(ops, OP)
char *
expand_strdup( const char *s, const conffile_t *cfile )
{
@ -310,6 +314,10 @@ merge_ops( int cops, int ops[], const char *chan_name )
int aops, op;
uint i;
if (!cops && !ops[F] && !ops[N]) // Only to denoise the debug output
return 0;
debug( "merge ops (%s):\n common: %s\n far: %s\n near: %s\n",
channel_str( chan_name ), fmt_ops( cops ).str, fmt_ops( ops[F] ).str, fmt_ops( ops[N] ).str );
aops = ops[F] | ops[N];
if (ops[F] & XOP_HAVE_TYPE) {
if (aops & OP_MASK_TYPE) { // PullNew, etc.
@ -377,6 +385,7 @@ merge_ops( int cops, int ops[], const char *chan_name )
ops[N] |= cops & op;
}
}
debug( " => far: %s\n => near: %s\n", fmt_ops( ops[F] ).str, fmt_ops( ops[N] ).str );
return 0;
}

2
src/main_sync.c

@ -186,6 +186,8 @@ add_channel( chan_ent_t ***chanapp, channel_conf_t *chan, int ops[] )
merge_actions( chan, ops, XOP_HAVE_CREATE, OP_CREATE, 0 );
merge_actions( chan, ops, XOP_HAVE_REMOVE, OP_REMOVE, 0 );
merge_actions( chan, ops, XOP_HAVE_EXPUNGE, OP_EXPUNGE, 0 );
debug( "channel ops (%s):\n far: %s\n near: %s\n",
chan->name, fmt_ops( ops[F] ).str, fmt_ops( ops[N] ).str );
for (int t = 0; t < 2; t++) {
if (chan->ops[t] & OP_MASK_TYPE)

2
src/sync.h

@ -41,6 +41,8 @@ BIT_ENUM(
#define OP_MASK_TYPE (OP_NEW | OP_RENEW | OP_DELETE | OP_FLAGS) // Asserted in the target side ops
#define XOP_MASK_DIR (XOP_PUSH | XOP_PULL)
DECL_BIT_FORMATTER_FUNCTION(ops, OP)
typedef struct channel_conf {
struct channel_conf *next;
const char *name;

Loading…
Cancel
Save