Browse Source

provide a proper getter callback for driver capabilities

that way driver_t contains only callbacks.
wip/movedetect
Oswald Buddenhagen 8 years ago
parent
commit
f46cf8c887
  1. 3
      src/driver.h
  2. 8
      src/drv_imap.c
  3. 8
      src/drv_maildir.c
  4. 0
      src/drv_proxy.c
  5. 2
      src/main.c
  6. 4
      src/sync.c

3
src/driver.h

@ -147,7 +147,8 @@ typedef struct {
#define LIST_PATH_MAYBE 4
struct driver {
int flags;
/* Return driver capabilities. */
int (*get_caps)( store_t *ctx );
/* Parse configuration. */
int (*parse_store)( conffile_t *cfg, store_conf_t **storep );

8
src/drv_imap.c

@ -3183,8 +3183,14 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
return 1;
}
static int
imap_get_caps( store_t *gctx ATTR_UNUSED )
{
return DRV_CRLF | DRV_VERBOSE;
}
struct driver imap_driver = {
DRV_CRLF | DRV_VERBOSE,
imap_get_caps,
imap_parse_store,
imap_cleanup,
imap_alloc_store,

8
src/drv_maildir.c

@ -1865,8 +1865,14 @@ maildir_parse_store( conffile_t *cfg, store_conf_t **storep )
return 1;
}
static int
maildir_get_caps( store_t *gctx ATTR_UNUSED )
{
return 0; /* XXX DRV_CRLF? */
}
struct driver maildir_driver = {
0, /* XXX DRV_CRLF? */
maildir_get_caps,
maildir_parse_store,
maildir_cleanup_drv,
maildir_alloc_store,

0
src/drv_proxy.c

2
src/main.c

@ -810,7 +810,7 @@ sync_chans( main_vars_t *mvars, int ent )
if (mvars->skip)
goto next2;
mvars->state[M] = mvars->state[S] = ST_FRESH;
if (mvars->chan->stores[M]->driver->flags & mvars->chan->stores[S]->driver->flags & DRV_VERBOSE)
if (mvars->chan->stores[M]->driver->get_caps( 0 ) & mvars->chan->stores[S]->driver->get_caps( 0 ) & DRV_VERBOSE)
labels[M] = "M: ", labels[S] = "S: ";
else
labels[M] = labels[S] = "";

4
src/sync.c

@ -407,8 +407,8 @@ msg_fetched( int sts, void *aux )
vars->msg->flags = vars->data.flags;
scr = (svars->drv[1-t]->flags / DRV_CRLF) & 1;
tcr = (svars->drv[t]->flags / DRV_CRLF) & 1;
scr = (svars->drv[1-t]->get_caps( svars->ctx[1-t] ) / DRV_CRLF) & 1;
tcr = (svars->drv[t]->get_caps( svars->ctx[t] ) / DRV_CRLF) & 1;
if (vars->srec || scr != tcr) {
if (!copy_msg_convert( scr, tcr, vars )) {
warn( "Warning: message %d from %s has incomplete header.\n",

Loading…
Cancel
Save