fprintf (stderr, "Error: '%s' is not a directory: %s\n",
path, strerror (EEXIST));
return false;
fprintf (stderr, "Error: '%s' is not a directory: %s\n",
path, strerror (EEXIST));
return false;
-maildir_mktemp (const void *ctx, const char *maildir, char **path_out)
+maildir_mktemp (const void *ctx, const char *maildir, bool world_readable, char **path_out)
-maildir_write_tmp (const void *ctx, int fdin, const char *maildir)
+maildir_write_tmp (const void *ctx, int fdin, const char *maildir, bool world_readable)
- fdout = maildir_mktemp (ctx, maildir, &path);
+ fdout = maildir_mktemp (ctx, maildir, world_readable, &path);
-maildir_write_new (const void *ctx, int fdin, const char *maildir)
+maildir_write_new (const void *ctx, int fdin, const char *maildir, bool world_readable)
{
char *cleanpath, *tmppath, *newpath, *newdir;
{
char *cleanpath, *tmppath, *newpath, *newdir;
- tmppath = maildir_write_tmp (ctx, fdin, maildir);
+ tmppath = maildir_write_tmp (ctx, fdin, maildir, world_readable);
notmuch_opt_desc_t options[] = {
{ .opt_string = &folder, .name = "folder", .allow_empty = true },
{ .opt_bool = &create_folder, .name = "create-folder" },
{ .opt_bool = &keep, .name = "keep" },
notmuch_opt_desc_t options[] = {
{ .opt_string = &folder, .name = "folder", .allow_empty = true },
{ .opt_bool = &create_folder, .name = "create-folder" },
{ .opt_bool = &keep, .name = "keep" },
- { .opt_bool = &no_hooks, .name = "no-hooks" },
+ { .opt_bool = &hooks, .name = "hooks" },
+ { .opt_bool = &world_readable, .name = "world-readable" },
{ .opt_inherit = notmuch_shared_indexing_options },
{ .opt_inherit = notmuch_shared_options },
{ }
{ .opt_inherit = notmuch_shared_indexing_options },
{ .opt_inherit = notmuch_shared_options },
{ }
- db_path = notmuch_config_get_database_path (config);
- new_tags = notmuch_config_get_new_tags (config, &new_tags_length);
- synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);
+ mail_root = notmuch_config_get (notmuch, NOTMUCH_CONFIG_MAIL_ROOT);
+
+ new_tags = notmuch_config_get_values (notmuch, NOTMUCH_CONFIG_NEW_TAGS);
+
+ if (print_status_database (
+ "notmuch insert",
+ notmuch,
+ notmuch_config_get_bool (notmuch, NOTMUCH_CONFIG_SYNC_MAILDIR_FLAGS,
+ &synchronize_flags)))
+ return EXIT_FAILURE;
- if (parse_tag_command_line (config, argc - opt_index, argv + opt_index,
+ if (parse_tag_command_line (local, argc - opt_index, argv + opt_index,
- maildir = talloc_asprintf (config, "%s/%s", db_path, folder);
+ maildir = talloc_asprintf (local, "%s/%s", mail_root, folder);
if (! maildir) {
fprintf (stderr, "Out of memory\n");
return EXIT_FAILURE;
}
strip_trailing (maildir, '/');
if (! maildir) {
fprintf (stderr, "Out of memory\n");
return EXIT_FAILURE;
}
strip_trailing (maildir, '/');
sigaction (SIGINT, &action, NULL);
/* Write the message to the Maildir new directory. */
sigaction (SIGINT, &action, NULL);
/* Write the message to the Maildir new directory. */
- newpath = maildir_write_new (config, STDIN_FILENO, maildir);
+ newpath = maildir_write_new (local, STDIN_FILENO, maildir, world_readable);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
notmuch_status_to_string (status));
status = add_file (notmuch, newpath, tag_ops, synchronize_flags, keep, indexing_cli_choices.opts);
/* Commit changes. */
status = add_file (notmuch, newpath, tag_ops, synchronize_flags, keep, indexing_cli_choices.opts);
/* Commit changes. */