Browse Source

split driver->prepare into ->prepare_opts and ->prepare_paths

Oswald Buddenhagen 19 năm trước cách đây
mục cha
commit
a1c402678c
4 tập tin đã thay đổi với 20 bổ sung6 xóa
  1. 8 2
      src/drv_imap.c
  2. 8 2
      src/drv_maildir.c
  3. 2 1
      src/isync.h
  4. 2 1
      src/sync.c

+ 8 - 2
src/drv_imap.c

@@ -1398,10 +1398,15 @@ imap_open_store( store_conf_t *conf, store_t *oldctx )
 }
 
 static void
-imap_prepare( store_t *gctx, int opts )
+imap_prepare_paths( store_t *gctx )
 {
 	free_generic_messages( gctx->msgs );
 	gctx->msgs = 0;
+}
+
+static void
+imap_prepare_opts( store_t *gctx, int opts )
+{
 	gctx->opts = opts;
 }
 
@@ -1812,7 +1817,8 @@ struct driver imap_driver = {
 	imap_open_store,
 	imap_close_store,
 	imap_list,
-	imap_prepare,
+	imap_prepare_paths,
+	imap_prepare_opts,
 	imap_select,
 	imap_fetch_msg,
 	imap_store_msg,

+ 8 - 2
src/drv_maildir.c

@@ -703,7 +703,7 @@ maildir_app_msg( maildir_store_t *ctx, message_t ***msgapp, msg_t *entry )
 }
 
 static void
-maildir_prepare( store_t *gctx, int opts )
+maildir_prepare_paths( store_t *gctx )
 {
 	maildir_store_t *ctx = (maildir_store_t *)gctx;
 
@@ -717,6 +717,11 @@ maildir_prepare( store_t *gctx, int opts )
 		gctx->path = nfstrdup( ((maildir_store_conf_t *)gctx->conf)->inbox );
 	else
 		nfasprintf( &gctx->path, "%s%s", gctx->conf->path, gctx->name );
+}
+
+static void
+maildir_prepare_opts( store_t *gctx, int opts )
+{
 	if (opts & OPEN_SETFLAGS)
 		opts |= OPEN_OLD;
 	if (opts & OPEN_EXPUNGE)
@@ -1188,7 +1193,8 @@ struct driver maildir_driver = {
 	maildir_open_store,
 	maildir_close_store,
 	maildir_list,
-	maildir_prepare,
+	maildir_prepare_paths,
+	maildir_prepare_opts,
 	maildir_select,
 	maildir_fetch_msg,
 	maildir_store_msg,

+ 2 - 1
src/isync.h

@@ -171,7 +171,8 @@ struct driver {
 	store_t *(*open_store)( store_conf_t *conf, store_t *oldctx );
 	void (*close_store)( store_t *ctx );
 	int (*list)( store_t *ctx, string_list_t **boxes );
-	void (*prepare)( store_t *ctx, int opts );
+	void (*prepare_paths)( store_t *ctx );
+	void (*prepare_opts)( store_t *ctx, int opts );
 	int (*select)( store_t *ctx, int minuid, int maxuid, int *excs, int nexcs );
 	int (*fetch_msg)( store_t *ctx, message_t *msg, msg_data_t *data );
 	int (*store_msg)( store_t *ctx, msg_data_t *data, int *uid ); /* if uid is null, store to trash */

+ 2 - 1
src/sync.c

@@ -236,7 +236,8 @@ sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan )
 				"INBOX" : names[t];
 		ctx[t]->uidvalidity = 0;
 		driver[t] = ctx[t]->conf->driver;
-		driver[t]->prepare( ctx[t], opts[t] );
+		driver[t]->prepare_paths( ctx[t] );
+		driver[t]->prepare_opts( ctx[t], opts[t] );
 	}
 
 	if (!strcmp( chan->sync_state ? chan->sync_state : global_sync_state, "*" )) {