[PATCH 04/10] reply: Support --use-schema
authorAustin Clements <amdragon@MIT.EDU>
Sun, 2 Dec 2012 02:39:56 +0000 (21:39 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:18 +0000 (09:51 -0800)
0c/9bef9d54ee784df74483eb7c2e4207bae85885 [new file with mode: 0644]

diff --git a/0c/9bef9d54ee784df74483eb7c2e4207bae85885 b/0c/9bef9d54ee784df74483eb7c2e4207bae85885
new file mode 100644 (file)
index 0000000..86ae629
--- /dev/null
@@ -0,0 +1,156 @@
+Return-Path: <amdragon@mit.edu>\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 6D0D5431FD9\r
+       for <notmuch@notmuchmail.org>; Sat,  1 Dec 2012 18:40:14 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 mug57YC5HIMn for <notmuch@notmuchmail.org>;\r
+       Sat,  1 Dec 2012 18:40:13 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+       [18.7.68.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7E111431FBC\r
+       for <notmuch@notmuchmail.org>; Sat,  1 Dec 2012 18:40:13 -0800 (PST)\r
+X-AuditID: 12074424-b7fe06d0000008f0-34-50babf8d77b4\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 88.06.02288.D8FBAB05; Sat,  1 Dec 2012 21:40:13 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qB22eCig022863; \r
+       Sat, 1 Dec 2012 21:40:12 -0500\r
+Received: from drake.dyndns.org\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qB22e64U025598\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 1 Dec 2012 21:40:10 -0500 (EST)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TezTR-0000xY-U0; Sat, 01 Dec 2012 21:40:05 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 04/10] reply: Support --use-schema\r
+Date: Sat,  1 Dec 2012 21:39:56 -0500\r
+Message-Id: <1354416002-3557-4-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1354416002-3557-1-git-send-email-amdragon@mit.edu>\r
+References: <1354416002-3557-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixG6nrtu7f1eAwf/1AhbXb85kdmD0eLbq\r
+       FnMAYxSXTUpqTmZZapG+XQJXxvKn/5kLjolULNo7l7WBcaNAFyMnh4SAicTsCxeZIGwxiQv3\r
+       1rN1MXJxCAnsY5ToPfQHylnPKPHv0RZGCOchk8S91x+gMnMZJSZcussM0s8moCGxbf9yRhBb\r
+       REBaYufd2axdjBwczAJqEn+6VEDCwgJGEjOWbGQGCbMIqErs+lsCEuYVsJeYu2MBO8QVihLd\r
+       zyawgZRwCjhIrOjmAQkLAZX8/32NbQIj/wJGhlWMsim5Vbq5iZk5xanJusXJiXl5qUW65nq5\r
+       mSV6qSmlmxjBIeOisoOx+ZDSIUYBDkYlHt7IObsChFgTy4orcw8xSnIwKYnyXtkBFOJLyk+p\r
+       zEgszogvKs1JLT7EKMHBrCTCy2IClONNSaysSi3Kh0lJc7AoifNeT7npLySQnliSmp2aWpBa\r
+       BJOV4eBQkuC9vBeoUbAoNT21Ii0zpwQhzcTBCTKcB2h4BkgNb3FBYm5xZjpE/hSjopQ4bxRI\r
+       QgAkkVGaB9cLi+lXjOJArwjzCuwDquIBpgO47ldAg5mABr9Zth1kcEkiQkqqgdHAo/HHDWtz\r
+       rpbWM37/bhjcWtT7tNHvQpDJuh9rJ/pcDJHMC+9P4mGMXXzx9otPjwNfW+bPuSB6yCrzf1XY\r
+       8f0Hw9/Vfe7p5e0L0ZvqGhJ1Ul7ryaILrFPnLpQMnsgeM+f4Aa8nVap5Wy9X8swSEtdfrfTs\r
+       Z/Su+5Hf0uL8lRPqd9+cWii8tVWJpTgj0VCLuag4EQDfJRzIxAIAAA==\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, 02 Dec 2012 02:40:14 -0000\r
+\r
+---\r
+ man/man1/notmuch-reply.1 |   21 +++++++++++++++++++++\r
+ notmuch-client.h         |    4 ++++\r
+ notmuch-reply.c          |    3 +++\r
+ 3 files changed, 28 insertions(+)\r
+\r
+diff --git a/man/man1/notmuch-reply.1 b/man/man1/notmuch-reply.1\r
+index d264060..71ff569 100644\r
+--- a/man/man1/notmuch-reply.1\r
++++ b/man/man1/notmuch-reply.1\r
+@@ -52,6 +52,16 @@ to create a reply message intelligently.\r
+ Only produces In\-Reply\-To, References, To, Cc, and Bcc headers.\r
+ .RE\r
+ .RE\r
++\r
++.RS\r
++.TP 4\r
++.BR \-\-use-schema=N\r
++\r
++Use the specified structured output schema version.  This is intended\r
++for programs that invoke \fBnotmuch\fR(1) internally.  If omitted, the\r
++latest supported version will be used.\r
++.RE\r
++\r
+ .RS\r
+ .TP 4\r
+ .BR \-\-reply\-to= ( all | sender )\r
+@@ -93,6 +103,17 @@ replying to multiple messages at once, but the JSON format does not.\r
+ .RE\r
+ .RE\r
\r
++.SH EXIT STATUS\r
++\r
++This command supports the following special exit status codes\r
++\r
++.TP\r
++.B 20\r
++The requested schema version is too old.\r
++.TP\r
++.B 21\r
++The requested schema version is too new.\r
++\r
+ .SH SEE ALSO\r
\r
+ \fBnotmuch\fR(1), \fBnotmuch-config\fR(1), \fBnotmuch-count\fR(1),\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index d931bbf..0eb6b36 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -144,6 +144,10 @@ chomp_newline (char *str)\r
+ #define NOTMUCH_SCHEMA_SEARCH 1\r
+ /* The minimum schema version supported by the "show" command. */\r
+ #define NOTMUCH_SCHEMA_SHOW 1\r
++/* The minimum schema version supported by the "reply" command.  Reply\r
++ * uses show, so in general this must be >= NOTMUCH_SCHEMA_SHOW.\r
++ */\r
++#define NOTMUCH_SCHEMA_REPLY 1\r
\r
+ /* The schema version requested by the caller on the command line.  If\r
+  * no schema version is requested, this should be set to\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index e60a264..059a412 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -724,6 +724,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
+                                 { "json", FORMAT_JSON },\r
+                                 { "headers-only", FORMAT_HEADERS_ONLY },\r
+                                 { 0, 0 } } },\r
++      { NOTMUCH_OPT_INT, &notmuch_schema_version, "use-schema", 0, 0 },\r
+       { NOTMUCH_OPT_KEYWORD, &reply_all, "reply-to", 'r',\r
+         (notmuch_keyword_t []){ { "all", TRUE },\r
+                                 { "sender", FALSE },\r
+@@ -745,6 +746,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])\r
+     else\r
+       reply_format_func = notmuch_reply_format_default;\r
\r
++    notmuch_exit_if_unsupported_schema ("reply", NOTMUCH_SCHEMA_REPLY);\r
++\r
+     config = notmuch_config_open (ctx, NULL, NULL);\r
+     if (config == NULL)\r
+       return 1;\r
+-- \r
+1.7.10.4\r
+\r