1 Return-Path: <Sebastian@SSpaeth.de>
\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 2DEA0431FBD
\r
6 for <notmuch@notmuchmail.org>; Tue, 2 Mar 2010 04:37:57 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.959 tagged_above=-999 required=5 tests=[AWL=0.640,
\r
12 BAYES_00=-2.599] 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 wbUBl5-sWkPL for <notmuch@notmuchmail.org>;
\r
16 Tue, 2 Mar 2010 04:37:56 -0800 (PST)
\r
17 Received: from homiemail-a15.g.dreamhost.com (caiajhbdcagg.dreamhost.com
\r
19 by olra.theworths.org (Postfix) with ESMTP id 88785431FAE
\r
20 for <notmuch@notmuchmail.org>; Tue, 2 Mar 2010 04:37:56 -0800 (PST)
\r
21 Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch
\r
23 by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPA id F114476C065;
\r
24 Tue, 2 Mar 2010 04:37:46 -0800 (PST)
\r
25 From: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
26 To: notmuch@notmuchmail.org
\r
27 Date: Tue, 2 Mar 2010 13:37:42 +0100
\r
28 Message-Id: <1267533462-15682-1-git-send-email-Sebastian@SSpaeth.de>
\r
29 X-Mailer: git-send-email 1.6.3.3
\r
30 Subject: [notmuch] [PATCH] notmuch-reply: Use a shorter 'On, X Y wrote:' line
\r
31 X-BeenThere: notmuch@notmuchmail.org
\r
32 X-Mailman-Version: 2.1.13
\r
34 List-Id: "Use and development of the notmuch mail system."
\r
35 <notmuch.notmuchmail.org>
\r
36 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
37 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
38 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
39 List-Post: <mailto:notmuch@notmuchmail.org>
\r
40 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
41 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
43 X-List-Received-Date: Tue, 02 Mar 2010 12:37:57 -0000
\r
45 Previously, we would output:
\r
46 'On Thu, 25 Feb 2010 14:32:54 +0100, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:' now it is:
\r
47 'On 2010-02-25, Sebastian Spaeth wrote:'
\r
49 In case we don't find a '<' (as indicator for 'Realname <email>'), we still use the whole from address.
\r
51 Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
53 This probably shows my lack of C skills quite nicely but it does the job for me.
\r
55 notmuch-reply.c | 21 ++++++++++++++++++---
\r
56 1 files changed, 18 insertions(+), 3 deletions(-)
\r
58 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
59 index 98f6442..929572f 100644
\r
60 --- a/notmuch-reply.c
\r
61 +++ b/notmuch-reply.c
\r
62 @@ -288,9 +288,12 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
\r
63 GMimeMessage *reply;
\r
64 notmuch_messages_t *messages;
\r
65 notmuch_message_t *message;
\r
66 - const char *subject, *from_addr = NULL;
\r
67 + const char *subject, *from_addr = NULL, *short_from;
\r
68 const char *in_reply_to, *orig_references, *references;
\r
69 char *reply_headers;
\r
71 + struct tm *datetm;
\r
74 for (messages = notmuch_query_search_messages (query);
\r
75 notmuch_messages_has_more (messages);
\r
76 @@ -346,10 +349,21 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
\r
77 g_object_unref (G_OBJECT (reply));
\r
80 + date = notmuch_message_get_date(message);
\r
81 + datetm = gmtime( &date );
\r
82 + datestr = talloc_array(ctx, char, 11);
\r
83 + strftime(datestr, 11, "%Y-%m-%d", datetm);
\r
85 + /* If from contains '<' (not as first char),
\r
86 + * only use the preceding real name */
\r
87 + short_from = talloc_strdup(ctx, from_addr);
\r
88 + if (strstr(short_from, "<") > short_from) {
\r
89 + *(strstr(short_from, "<")-1) = 0;
\r
92 printf ("On %s, %s wrote:\n",
\r
93 - notmuch_message_get_header (message, "date"),
\r
94 - notmuch_message_get_header (message, "from"));
\r
98 show_message_body (notmuch_message_get_filename (message), reply_part);
\r