commit f46cf8c887db43ac8dc31b68a4d7405fdf5d56b3
Author: Oswald Buddenhagen <[email protected]>
Date: Sun Mar 19 13:50:41 2017 +0100
provide a proper getter callback for driver capabilities
that way driver_t contains only callbacks.
src/driver.h | 3 ++-
src/drv_imap.c | 8 +++++++-
src/drv_maildir.c | 8 +++++++-
src/drv_proxy.c | 0
src/main.c | 2 +-
src/sync.c | 4 ++--
6 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/driver.h b/src/driver.h
index 1e7660c..6eb98c5 100644
--- a/src/driver.h
+++ b/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 );
diff --git a/src/drv_imap.c b/src/drv_imap.c
index 53e5b8f..1dff927 100644
--- a/src/drv_imap.c
+++ b/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,
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 8b2da7b..70d59af 100644
--- a/src/drv_maildir.c
+++ b/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,
diff --git a/src/drv_proxy.c b/src/drv_proxy.c
new file mode 100644
index 0000000..e69de29
diff --git a/src/main.c b/src/main.c
index bb41e76..013f28f 100644
--- a/src/main.c
+++ b/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] = "";
diff --git a/src/sync.c b/src/sync.c
index 509e64a..5a7a491 100644
--- a/src/sync.c
+++ b/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",
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel