1 Return-Path: <sojkam1@fel.cvut.cz>
\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 529AE4196F2
\r
6 for <notmuch@notmuchmail.org>; Tue, 20 Apr 2010 00:16:39 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id CBDtwRkU1P5h for <notmuch@notmuchmail.org>;
\r
16 Tue, 20 Apr 2010 00:16:36 -0700 (PDT)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 3E93C431FC1
\r
19 for <notmuch@notmuchmail.org>; Tue, 20 Apr 2010 00:16:36 -0700 (PDT)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id 580D319F333C
\r
22 for <notmuch@notmuchmail.org>; Tue, 20 Apr 2010 09:16:35 +0200 (CEST)
\r
23 X-Virus-Scanned: IMAP AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,
\r
26 port 10044) with ESMTP id npSYaBTh2DUN for <notmuch@notmuchmail.org>;
\r
27 Tue, 20 Apr 2010 09:16:33 +0200 (CEST)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id E5A3419F3349
\r
30 for <notmuch@notmuchmail.org>; Tue, 20 Apr 2010 09:16:33 +0200 (CEST)
\r
31 Received: from steelpick.2x.cz (k335-30.felk.cvut.cz [147.32.86.30])
\r
32 (Authenticated sender: sojkam1)
\r
33 by imap.feld.cvut.cz (Postfix) with ESMTPSA id E07EEFA003
\r
34 for <notmuch@notmuchmail.org>; Tue, 20 Apr 2010 09:16:33 +0200 (CEST)
\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.71)
\r
36 (envelope-from <sojkam1@fel.cvut.cz>) id 1O47hB-0004Yt-Ii
\r
37 for notmuch@notmuchmail.org; Tue, 20 Apr 2010 09:16:33 +0200
\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 1/2] Add 'cat' subcommand
\r
41 Date: Tue, 20 Apr 2010 09:16:32 +0200
\r
42 Message-Id: <1271747793-17507-1-git-send-email-sojkam1@fel.cvut.cz>
\r
43 X-Mailer: git-send-email 1.7.0.4
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Tue, 20 Apr 2010 07:16:39 -0000
\r
58 This command dumps a raw message identified by a filename to the
\r
59 standard output. It allows MUAs to access the messages for piping,
\r
60 attachment manipulation, etc. in the same way as it is done in
\r
61 notmuch-show-mode (through notmuch show subcommand). This will simplify
\r
62 the MUAs when they need to operate with a remote database.
\r
64 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
\r
67 notmuch-client.h | 3 +++
\r
68 notmuch-show.c | 39 +++++++++++++++++++++++++++++++++++++++
\r
70 4 files changed, 49 insertions(+), 0 deletions(-)
\r
72 diff --git a/NEWS b/NEWS
\r
73 index eba0fd5..1a81e64 100644
\r
77 +A new subcommand 'cat' was added, which simplifies use of Emacs
\r
78 +interface with remote database (accessed over SSH).
\r
80 Notmuch 0.2 (2010-04-16)
\r
81 ========================
\r
82 This is the second release of the notmuch mail system, with actual
\r
83 diff --git a/notmuch-client.h b/notmuch-client.h
\r
84 index d36b9ec..0efc41c 100644
\r
85 --- a/notmuch-client.h
\r
86 +++ b/notmuch-client.h
\r
87 @@ -111,6 +111,9 @@ int
\r
88 notmuch_search_tags_command (void *ctx, int argc, char *argv[]);
\r
91 +notmuch_cat_command (void *ctx, int argc, char *argv[]);
\r
94 notmuch_part_command (void *ctx, int argc, char *argv[]);
\r
97 diff --git a/notmuch-show.c b/notmuch-show.c
\r
98 index 76873a1..bade9bb 100644
\r
99 --- a/notmuch-show.c
\r
100 +++ b/notmuch-show.c
\r
101 @@ -504,6 +504,45 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
105 +notmuch_cat_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
109 + const char *filename;
\r
115 + for (i = 0; i < argc && argv[i][0] == '-'; i++) {
\r
116 + fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
\r
124 + fprintf (stderr, "Error: No filename given\n");
\r
127 + filename = argv[0];
\r
129 + file = fopen (filename, "r");
\r
130 + if (file == NULL) {
\r
131 + fprintf (stderr, "Error: Cannot open %s: %s\n", filename, strerror (errno));
\r
134 + while (!feof (file)) {
\r
135 + size = fread(buf, 1, sizeof(buf), file);
\r
136 + fwrite (buf, size, 1, stdout);
\r
144 notmuch_part_command (void *ctx, unused (int argc), unused (char *argv[]))
\r
146 notmuch_config_t *config;
\r
147 diff --git a/notmuch.c b/notmuch.c
\r
148 index 0eea5e1..477d746 100644
\r
151 @@ -296,6 +296,10 @@ command_t commands[] = {
\r
152 "\tcontain tags only from messages that match the search-term(s).\n"
\r
154 "\tIn both cases the list will be alphabetically sorted." },
\r
155 + { "cat", notmuch_cat_command,
\r
157 + "Dump raw message identified by path to standard output.",
\r
159 { "part", notmuch_part_command,
\r
160 "--part=<num> <search-terms>",
\r
161 "Output a single MIME part of a message.",
\r