/* notmuch - Not much of an email program, (just index and search)
*
* Copyright © 2009 Carl Worth
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/ .
*
* Author: Carl Worth <cworth@cworth.org>
*/
#include "notmuch-client.h"
#include <pwd.h>
#include <netdb.h>
#include <assert.h>
static const char toplevel_config_comment[] =
" .notmuch-config - Configuration file for the notmuch mail system\n"
"\n"
" For more information about notmuch, see https://notmuchmail.org";
static const char database_config_comment[] =
" Database configuration\n"
"\n"
" The only value supported here is 'path' which should be the top-level\n"
" directory where your mail currently exists and to where mail will be\n"
" delivered in the future. Files should be individual email messages.\n"
" Notmuch will store its database within a sub-directory of the path\n"
" configured here named \".notmuch\".\n";
static const char new_config_comment[] =
" Configuration for \"notmuch new\"\n"
"\n"
" The following options are supported here:\n"
"\n"
"\ttags A list (separated by ';') of the tags that will be\n"
"\t added to all messages incorporated by \"notmuch new\".\n"
"\n"
"\tignore A list (separated by ';') of file and directory names\n"
"\t that will not be searched for messages by \"notmuch new\".\n"
"\n"
"\t NOTE: *Every* file/directory that goes by one of those\n"
"\t names will be ignored, independent of its depth/location\n"
"\t in the mail store.\n";
static const char user_config_comment[] =
" User configuration\n"
"\n"
" Here is where you can let notmuch know how you would like to be\n"
" addressed. Valid settings are\n"
"\n"
"\tname Your full name.\n"
"\tprimary_email Your primary email address.\n"
"\tother_email A list (separated by ';') of other email addresses\n"
"\t at which you receive email.\n"
"\n"
" Notmuch will use the various email addresses configured here when\n"
" formatting replies. It will avoid including your own addresses in the\n"
" recipient list of replies, and will set the From address based on the\n"
" address to which the original email was addressed.\n";
static const char maildir_config_comment[] =
" Maildir compatibility configuration\n"
"\n"
" The following option is supported here:\n"
"\n"
"\tsynchronize_flags Valid values are true and false.\n"
"\n"
"\tIf true, then the following maildir flags (in message filenames)\n"
"\twill be synchronized with the corresponding notmuch tags:\n"
"\n"
"\t\tFlag Tag\n"
"\t\t---- -------\n"
"\t\tD draft\n"
"\t\tF flagged\n"
"\t\tP passed\n"
"\t\tR replied\n"
"\t\tS unread (added when 'S' flag is not present)\n"
"\n"
"\tThe \"notmuch new\" command will notice flag changes in filenames\n"
"\tand update tags, while the \"notmuch tag\" and \"notmuch restore\"\n"
"\tcommands will notice tag changes and update flags in filenames\n";
static const char search_config_comment[] =
" Search configuration\n"
"\n"
" The following option is supported here:\n"
"\n"
"\texclude_tags\n"
"\t\tA ;-separated list of tags that will be excluded from\n"
"\t\tsearch results by default. Using an excluded tag in a\n"
"\t\tquery will override that exclusion.\n";
static const char crypto_config_comment[] =
" Cryptography related configuration\n"
"\n"
#if (GMIME_MAJOR_VERSION < 3)
" The following *deprecated* option is currently supported:\n"
"\n"
"\tgpg_path\n"
"\t\tbinary name or full path to invoke gpg.\n"
"\t\tNOTE: In a future build, this option will be ignored.\n"
#else
" The following old option is now ignored:\n"
"\n"
"\tgpgpath\n"
"\t\tThis option was used by older builds of notmuch to choose\n"
"\t\tthe version of gpg to use.\n"
#endif
"\t\tSetting $PATH is a better approach.\n";
struct _notmuch_config {
char *filename;
GKeyFile *key_file;
bool is_new;
char *database_path;
char *crypto_gpg_path;