--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 55641431FDE\r
+ for <notmuch@notmuchmail.org>; Sun, 3 Mar 2013 13:55:34 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id wadRa9PmoXdI for <notmuch@notmuchmail.org>;\r
+ Sun, 3 Mar 2013 13:55:33 -0800 (PST)\r
+Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com\r
+ [209.85.217.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id C9865431E62\r
+ for <notmuch@notmuchmail.org>; Sun, 3 Mar 2013 13:55:22 -0800 (PST)\r
+Received: by mail-lb0-f180.google.com with SMTP id q12so3500335lbc.11\r
+ for <notmuch@notmuchmail.org>; Sun, 03 Mar 2013 13:55:21 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+ :references:in-reply-to:references:x-gm-message-state;\r
+ bh=GbaZLqNuib6Un31BxcZvVhJmQJXcNymuaP73EOwI0fA=;\r
+ b=EDLpd923COAOwexqQjM7YekH+37VS7u1D/4Jy7YFyd2nGAU1ks2cb2fAQSRRG4Usg4\r
+ YbeloGP7+9SQCwwKXbu3Qg0tWT90M0WJNVePWzgB0DHEX1ntqQtmLgXHXYAmTrEjKN24\r
+ W0UjQ7w+U5AWrMmrnQOMfmy7xvaBeTq48+0jheoVv4CLMu2UP4SsZvAXVpqXcB+3t9sk\r
+ EYklm2qdHFecr2HTqkqQJ2ZN6paBVjfQBvsj3ZgdYKwPUGzic9W4SBE1mSKN/CEg9e4k\r
+ flHkcgWwnPDI6fLFgE5KAqMTh4JqAPBEO8KEP85DXJAPNQSFmkbk3Rz7ajU+fzggtQFk\r
+ lpxA==\r
+X-Received: by 10.152.46.12 with SMTP id r12mr15878857lam.15.1362347721311;\r
+ Sun, 03 Mar 2013 13:55:21 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+ [80.223.81.27])\r
+ by mx.google.com with ESMTPS id oy10sm10731246lab.8.2013.03.03.13.55.19\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sun, 03 Mar 2013 13:55:20 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 3/6] cli: config: keep track of whether the config is newly\r
+ created\r
+Date: Sun, 3 Mar 2013 23:55:07 +0200\r
+Message-Id:\r
+ <1a1e9d8e37f178b8e1c9e41162366f6b9f326c99.1362347362.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <cover.1362347362.git.jani@nikula.org>\r
+References: <cover.1362347362.git.jani@nikula.org>\r
+In-Reply-To: <cover.1362347362.git.jani@nikula.org>\r
+References: <cover.1362347362.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQmdfPAuHRwPJjpBZBChr9FVyHfvGsv9iOJF3ULYjBn84tjol02BhQE2s6HdbwcnYS7Ycb8M\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 03 Mar 2013 21:55:34 -0000\r
+\r
+Keep track of whether the config is newly created, and add\r
+notmuch_config_is_new() accessor function to query this.\r
+\r
+This is to support anyone with a config handle to check this, instead\r
+of just whoever called notmuch_config_open().\r
+---\r
+ notmuch-client.h | 3 +++\r
+ notmuch-config.c | 11 +++++++++++\r
+ 2 files changed, 14 insertions(+)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 5f28836..07367e0 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -256,6 +256,9 @@ notmuch_config_close (notmuch_config_t *config);\r
+ int\r
+ notmuch_config_save (notmuch_config_t *config);\r
+ \r
++notmuch_bool_t\r
++notmuch_config_is_new (notmuch_config_t *config);\r
++\r
+ const char *\r
+ notmuch_config_get_database_path (notmuch_config_t *config);\r
+ \r
+diff --git a/notmuch-config.c b/notmuch-config.c\r
+index b5c2066..e733e92 100644\r
+--- a/notmuch-config.c\r
++++ b/notmuch-config.c\r
+@@ -104,6 +104,7 @@ static const char search_config_comment[] =\r
+ struct _notmuch_config {\r
+ char *filename;\r
+ GKeyFile *key_file;\r
++ notmuch_bool_t is_new;\r
+ \r
+ char *database_path;\r
+ char *user_name;\r
+@@ -266,6 +267,7 @@ notmuch_config_open (void *ctx,\r
+ \r
+ config->key_file = g_key_file_new ();\r
+ \r
++ config->is_new = FALSE;\r
+ config->database_path = NULL;\r
+ config->user_name = NULL;\r
+ config->user_primary_email = NULL;\r
+@@ -435,6 +437,8 @@ notmuch_config_open (void *ctx,\r
+ if (is_new_ret)\r
+ *is_new_ret = is_new;\r
+ \r
++ config->is_new = is_new;\r
++\r
+ return config;\r
+ }\r
+ \r
+@@ -482,6 +486,13 @@ notmuch_config_save (notmuch_config_t *config)\r
+ return 0;\r
+ }\r
+ \r
++notmuch_bool_t\r
++notmuch_config_is_new (notmuch_config_t *config)\r
++{\r
++ return config->is_new;\r
++}\r
++\r
++\r
+ static const char **\r
+ _config_get_list (notmuch_config_t *config,\r
+ const char *section, const char *key,\r
+-- \r
+1.7.10.4\r
+\r