1 Return-Path: <glasse@cs.rpi.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id AA258431E62
\r
6 for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:03:45 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.54 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 RCVD_IN_BL_SPAMCOP_NET=1.246, RCVD_IN_DNSWL_MED=-2.3,
\r
14 RCVD_IN_SORBS_WEB=0.614] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id oFj-xM-d5f-G for <notmuch@notmuchmail.org>;
\r
18 Wed, 15 Feb 2012 14:03:42 -0800 (PST)
\r
19 Received: from cliffclavin.cs.rpi.edu (cliffclavin.cs.rpi.edu
\r
20 [128.113.126.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
21 (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS
\r
22 id EABB7429E43 for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:03:41 -0800
\r
25 S|7ad3c2d146a8219dfc8d49189731060e3e91b1eb|659f0d3bddb7bfac13f8ae4d08f67d7f
\r
26 X-Countries: Cameroon, United States
\r
27 X-SMTP-From: accepted <glasse@cs.rpi.edu> [195.24.209.20] [195.24.209.20]
\r
28 (localhost) {Cameroon}
\r
29 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cs.rpi.edu; h=from
\r
30 :to:cc:subject:date:message-id:in-reply-to:references; s=
\r
31 default; i=glasse@cs.rpi.edu; t=1329343419; x=1329948219; l=4069;
\r
32 bh=5gOw3XhAnZ/2lLrwabeVVCs9a1k=; b=HLTJgzhoH1mdfDTxrVw8gjT
\r
33 KoI8F2U0nr2w+984M5H9ivTEq3pSHVLDxBc+mzPMLRz5urh/s43i3QStJMSL98Uh
\r
34 taKn7EYYUhi44+dtRlzTAP8B+iFY0tpPev7aOBudTcsJ9u2F2ueLAm1r2HuiYcoX
\r
35 eevnOfu2HYoEfFlvYdM8=
\r
36 DomainKey-Signature: a=rsa-sha1; c=nofws; d=cs.rpi.edu; h=from:to:cc
\r
37 :subject:date:message-id:in-reply-to:references; q=dns; s=
\r
38 default; b=hcunpmesQ307tDAjPc8PDnBjEZWh0oFCVFlf2aSDqJNH1BB1ZQMYg
\r
39 u3oNH32yZ11zSOT14XMyUqdG615veLgSKq1812XK6LILccyJ1gJsoGGTuxxA8zjz
\r
40 Vay0t1rzGA+827L3BTWixuMrvmSDMf0aBIZvqggeFNzzedEGzD/taY=
\r
41 X-Spam-Info: -2.7; ALL_TRUSTED,AWL,BAYES_00
\r
42 X-Spam-Scanned-By: cliffclavin.cs.rpi.edu using SpamAssassin 3.2.5 (hard limit
\r
44 Authentication-Results: cliffclavin.cs.rpi.edu;
\r
45 DKIM=neutral (none) header.from=glasse@cs.rpi.edu;
\r
47 Mechanism '?all' matched) smtp.mail=glasse@cs.rpi.edu
\r
48 X-Auth-Passed: cliffclavin.cs.rpi.edu:q1FM3Eie008735 Auth:glasse
\r
49 X-Virus-Scanned-By: cliffclavin.cs.rpi.edu
\r
50 Received: from localhost ([195.24.209.20]) (authenticated bits=0)
\r
51 by cliffclavin.cs.rpi.edu (8.14.3/8.14.3) with ESMTP id q1FM3Eie008735
\r
52 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);
\r
53 Wed, 15 Feb 2012 17:03:30 -0500 (EST)
\r
54 (envelope-from glasse@cs.rpi.edu)
\r
55 From: Ethan Glasser-Camp <glasse@cs.rpi.edu>
\r
56 To: notmuch@notmuchmail.org
\r
57 Subject: [RFC PATCH 01/13] Create configuration paramater database.type
\r
58 Date: Wed, 15 Feb 2012 17:01:54 -0500
\r
59 Message-Id: <1329343326-16410-2-git-send-email-glasse@cs.rpi.edu>
\r
60 X-Mailer: git-send-email 1.7.5.4
\r
61 In-Reply-To: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>
\r
62 References: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>
\r
63 X-Scanned-By: MIMEDefang 2.67 on 128.113.126.25
\r
64 Cc: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Wed, 15 Feb 2012 22:03:45 -0000
\r
79 From: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
81 This will be used to allow different backends to be developed to allow
\r
82 access to mail that isn't stored in Maildirs.
\r
84 Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
86 notmuch-client.h | 7 ++++++
\r
87 notmuch-config.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++----
\r
88 2 files changed, 59 insertions(+), 5 deletions(-)
\r
90 diff --git a/notmuch-client.h b/notmuch-client.h
\r
91 index 60828aa..4518cb0 100644
\r
92 --- a/notmuch-client.h
\r
93 +++ b/notmuch-client.h
\r
94 @@ -220,6 +220,13 @@ notmuch_config_set_database_path (notmuch_config_t *config,
\r
95 const char *database_path);
\r
98 +notmuch_config_get_database_type (notmuch_config_t *config);
\r
101 +notmuch_config_set_database_type (notmuch_config_t *config,
\r
102 + const char *database_type);
\r
105 notmuch_config_get_user_name (notmuch_config_t *config);
\r
108 diff --git a/notmuch-config.c b/notmuch-config.c
\r
109 index a124e34..b8bee69 100644
\r
110 --- a/notmuch-config.c
\r
111 +++ b/notmuch-config.c
\r
112 @@ -32,11 +32,24 @@ static const char toplevel_config_comment[] =
\r
113 static const char database_config_comment[] =
\r
114 " Database configuration\n"
\r
116 - " The only value supported here is 'path' which should be the top-level\n"
\r
117 - " directory where your mail currently exists and to where mail will be\n"
\r
118 - " delivered in the future. Files should be individual email messages.\n"
\r
119 - " Notmuch will store its database within a sub-directory of the path\n"
\r
120 - " configured here named \".notmuch\".\n";
\r
121 + " Here is where you can tell notmuch where your mail currently exists\n"
\r
122 + " and where mail will be delivered in the future."
\r
124 + " The following options are supported here:\n"
\r
126 + "\ttype The type of mail backend. The only currently supported\n"
\r
127 + "\t value is \"maildir\".\n"
\r
128 + "\tpath For the maildir backend, the top-level maildir directory.\n"
\r
129 + "\t For all backends, the location where notmuch should store its\n"
\r
130 + "\t database. Notmuch will store its database within a sub-directory\n"
\r
131 + "\t of this path named \".notmuch\".\n"
\r
133 + " Maildir backend\n"
\r
135 + " This backend reads mail from a directory tree where files are\n"
\r
136 + " individual email messages.\n"
\r
137 + " The only configuration option is 'path' which should be the top-level\n"
\r
140 static const char new_config_comment[] =
\r
141 " Configuration for \"notmuch new\"\n"
\r
142 @@ -99,6 +112,7 @@ struct _notmuch_config {
\r
143 GKeyFile *key_file;
\r
145 char *database_path;
\r
146 + char *database_type;
\r
148 char *user_primary_email;
\r
149 const char **user_other_email;
\r
150 @@ -258,6 +272,7 @@ notmuch_config_open (void *ctx,
\r
151 config->key_file = g_key_file_new ();
\r
153 config->database_path = NULL;
\r
154 + config->database_type = NULL;
\r
155 config->user_name = NULL;
\r
156 config->user_primary_email = NULL;
\r
157 config->user_other_email = NULL;
\r
158 @@ -320,6 +335,10 @@ notmuch_config_open (void *ctx,
\r
159 talloc_free (path);
\r
162 + if (notmuch_config_get_database_type (config) == NULL) {
\r
163 + notmuch_config_set_database_type (config, "maildir");
\r
166 if (notmuch_config_get_user_name (config) == NULL) {
\r
167 char *name = get_name_from_passwd_file (config);
\r
168 notmuch_config_set_user_name (config, name);
\r
169 @@ -538,6 +557,34 @@ notmuch_config_set_database_path (notmuch_config_t *config,
\r
173 +notmuch_config_get_database_type (notmuch_config_t *config)
\r
177 + if (config->database_type == NULL) {
\r
178 + type = g_key_file_get_string (config->key_file,
\r
179 + "database", "type", NULL);
\r
181 + config->database_type = talloc_strdup (config, type);
\r
186 + return config->database_type;
\r
190 +notmuch_config_set_database_type (notmuch_config_t *config,
\r
191 + const char *database_type)
\r
193 + g_key_file_set_string (config->key_file,
\r
194 + "database", "type", database_type);
\r
196 + talloc_free (config->database_type);
\r
197 + config->database_type = NULL;
\r
201 notmuch_config_get_user_name (notmuch_config_t *config)
\r