X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-restore.c;h=081b504c93b044ba709669752e24f029697ff123;hb=986056bdbcfea642a2d08f7ee257f7aaaed433b9;hp=e2dc3d4550d548ac09f3892e7a6056826d6472a6;hpb=8c718a8190eb0820b5e3891b4643c99da50d0c08;p=notmuch diff --git a/notmuch-restore.c b/notmuch-restore.c index e2dc3d45..081b504c 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -219,9 +219,9 @@ parse_sup_line (void *ctx, char *line, } int -notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[]) +notmuch_restore_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, + int argc, char *argv[]) { - notmuch_database_t *notmuch; bool accumulate = false; tag_op_flag_t flags = 0; tag_op_list_t *tag_ops; @@ -238,12 +238,16 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[]) int include = 0; int input_format = DUMP_FORMAT_AUTO; int errnum; + notmuch_bool_t synchronize_flags; - if (notmuch_database_open (notmuch_config_get_database_path (config), - NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much)) + if (print_status_database ( + "notmuch restore", + notmuch, + notmuch_config_get_bool (notmuch, NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS, + &synchronize_flags))) return EXIT_FAILURE; - if (notmuch_config_get_maildir_synchronize_flags (config)) + if (synchronize_flags) flags |= TAG_FLAG_MAILDIR_SYNC; notmuch_opt_desc_t options[] = { @@ -310,7 +314,7 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[]) goto DONE; } - tag_ops = tag_op_list_create (config); + tag_ops = tag_op_list_create (notmuch); if (tag_ops == NULL) { fprintf (stderr, "Out of memory.\n"); ret = EXIT_FAILURE; @@ -340,7 +344,8 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[]) if (ret) goto DONE; } - if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == '=') { + if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == + '=') { ret = process_properties_line (notmuch, line + 2); if (ret) goto DONE; @@ -357,6 +362,7 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[]) } char *p; + for (p = line; (input_format == DUMP_FORMAT_AUTO) && *p; p++) { if (*p == '(') input_format = DUMP_FORMAT_SUP; @@ -377,9 +383,10 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[]) if (line_ctx != NULL) talloc_free (line_ctx); - line_ctx = talloc_new (config); + line_ctx = talloc_new (notmuch); - if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == '=') { + if ((include & DUMP_INCLUDE_PROPERTIES) && line_len >= 2 && line[0] == '#' && line[1] == + '=') { ret = process_properties_line (notmuch, line + 2); if (ret) goto DONE;