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 76922431FBC
\r
6 for <notmuch@notmuchmail.org>; Thu, 4 Mar 2010 06:42:02 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.246 tagged_above=-999 required=5 tests=[AWL=0.353,
\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 C7v037vDgtN1 for <notmuch@notmuchmail.org>;
\r
16 Thu, 4 Mar 2010 06:42:01 -0800 (PST)
\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 5E9DE431FAE
\r
19 for <notmuch@notmuchmail.org>; Thu, 4 Mar 2010 06:42:01 -0800 (PST)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id 7C88B19F32F8;
\r
22 Thu, 4 Mar 2010 15:41:49 +0100 (CET)
\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
27 with ESMTP id QdM8+a1Vf7go; Thu, 4 Mar 2010 15:41:47 +0100 (CET)
\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 8572019F35EF;
\r
30 Thu, 4 Mar 2010 15:41:47 +0100 (CET)
\r
31 Received: from steelpick.localdomain (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 57235FA003;
\r
34 Thu, 4 Mar 2010 15:41:46 +0100 (CET)
\r
35 Received: from wsh by steelpick.localdomain with local (Exim 4.71)
\r
36 (envelope-from <sojkam1@fel.cvut.cz>)
\r
37 id 1NnCFG-0007ng-Oe; Thu, 04 Mar 2010 15:41:46 +0100
\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
39 To: Sebastian Spaeth <Sebastian@SSpaeth.de>, notmuch@notmuchmail.org
\r
40 In-Reply-To: <1267533462-15682-1-git-send-email-Sebastian@SSpaeth.de>
\r
41 References: <1267533462-15682-1-git-send-email-Sebastian@SSpaeth.de>
\r
42 Date: Thu, 04 Mar 2010 15:41:46 +0100
\r
43 Message-ID: <87hbow409h.fsf@steelpick.localdomain>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 Subject: Re: [notmuch] [PATCH] notmuch-reply: Use a shorter 'On,
\r
48 X-BeenThere: notmuch@notmuchmail.org
\r
49 X-Mailman-Version: 2.1.13
\r
51 List-Id: "Use and development of the notmuch mail system."
\r
52 <notmuch.notmuchmail.org>
\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
56 List-Post: <mailto:notmuch@notmuchmail.org>
\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
60 X-List-Received-Date: Thu, 04 Mar 2010 14:42:02 -0000
\r
64 On Tue, 02 Mar 2010, Sebastian Spaeth wrote:
\r
65 > Previously, we would output:
\r
66 > 'On Thu, 25 Feb 2010 14:32:54 +0100, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:' now it is:
\r
67 > 'On 2010-02-25, Sebastian Spaeth wrote:'
\r
69 > In case we don't find a '<' (as indicator for 'Realname <email>'), we still use the whole from address.
\r
71 > Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
73 > This probably shows my lack of C skills quite nicely but it does the job for me.
\r
75 > notmuch-reply.c | 21 ++++++++++++++++++---
\r
76 > 1 files changed, 18 insertions(+), 3 deletions(-)
\r
78 > diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
79 > index 98f6442..929572f 100644
\r
80 > --- a/notmuch-reply.c
\r
81 > +++ b/notmuch-reply.c
\r
82 > @@ -288,9 +288,12 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
\r
83 > GMimeMessage *reply;
\r
84 > notmuch_messages_t *messages;
\r
85 > notmuch_message_t *message;
\r
86 > - const char *subject, *from_addr = NULL;
\r
87 > + const char *subject, *from_addr = NULL, *short_from;
\r
88 > const char *in_reply_to, *orig_references, *references;
\r
89 > char *reply_headers;
\r
91 > + struct tm *datetm;
\r
94 > for (messages = notmuch_query_search_messages (query);
\r
95 > notmuch_messages_has_more (messages);
\r
96 > @@ -346,10 +349,21 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
\r
98 I tried your patch. The first problem is that it doesn't apply. I had to
\r
99 change the number 10 to 9 in the line above.
\r
101 > + /* If from contains '<' (not as first char),
\r
102 > + * only use the preceding real name */
\r
103 > + short_from = talloc_strdup(ctx, from_addr);
\r
104 > + if (strstr(short_from, "<") > short_from) {
\r
105 > + *(strstr(short_from, "<")-1) = 0;
\r
108 > printf ("On %s, %s wrote:\n",
\r
109 > - notmuch_message_get_header (message, "date"),
\r
110 > - notmuch_message_get_header (message, "from"));
\r
114 The second problem is that the value of from_addr doesn't (always?)
\r
115 contain sender's addres. When I wanded to reply to this email with you
\r
116 patch applied, I got: "On 2010-03-02, Michal Sojka wrote:". So I fixed
\r
117 that in your patch and added removal of "" around name.
\r
119 >From 0555ba560fdaad3780c186b01b102670451585fb Mon Sep 17 00:00:00 2001
\r
120 From: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
121 Date: Tue, 2 Mar 2010 13:37:42 +0100
\r
122 Subject: [PATCH] notmuch-reply: Use a shorter 'On, X Y wrote:' line
\r
124 Previously, we would output:
\r
125 'On Thu, 25 Feb 2010 14:32:54 +0100, Sebastian Spaeth <Sebastian@SSpaeth.de> wrote:' now it is:
\r
126 'On 2010-02-25, Sebastian Spaeth wrote:'
\r
128 In case we don't find a '<' (as indicator for 'Realname <email>'), we still use the whole from address.
\r
130 Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
\r
132 Modified to use proper From header and strip "".
\r
133 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
\r
135 notmuch-reply.c | 28 +++++++++++++++++++++++++---
\r
136 1 files changed, 25 insertions(+), 3 deletions(-)
\r
138 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
139 index 98f6442..0ef4954 100644
\r
140 --- a/notmuch-reply.c
\r
141 +++ b/notmuch-reply.c
\r
142 @@ -288,9 +288,12 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
\r
143 GMimeMessage *reply;
\r
144 notmuch_messages_t *messages;
\r
145 notmuch_message_t *message;
\r
146 - const char *subject, *from_addr = NULL;
\r
147 + const char *subject, *from_addr = NULL, *short_from;
\r
148 const char *in_reply_to, *orig_references, *references;
\r
149 char *reply_headers;
\r
151 + struct tm *datetm;
\r
152 + char *datestr, *angle;
\r
154 for (messages = notmuch_query_search_messages (query);
\r
155 notmuch_messages_has_more (messages);
\r
156 @@ -346,9 +349,28 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t *config, notmuch_query_
\r
157 g_object_unref (G_OBJECT (reply));
\r
160 + date = notmuch_message_get_date(message);
\r
161 + datetm = gmtime( &date );
\r
162 + datestr = talloc_array(ctx, char, 11);
\r
163 + strftime(datestr, 11, "%Y-%m-%d", datetm);
\r
165 + /* If from contains '<' (not as first char), only use the
\r
166 + * preceding real name without "" (if present). */
\r
167 + short_from = notmuch_message_get_header (message, "from");
\r
168 + if ((angle = strchr(short_from, '<')) > short_from) {
\r
169 + while (angle-1 >= short_from && *(angle-1) == ' ')
\r
172 + if (*short_from == '"' && *(angle-1) == '"' &&
\r
173 + angle-1 > short_from) {
\r
175 + *(angle-1) = '\0';
\r
179 printf ("On %s, %s wrote:\n",
\r
180 - notmuch_message_get_header (message, "date"),
\r
181 - notmuch_message_get_header (message, "from"));
\r
185 show_message_body (notmuch_message_get_filename (message), reply_part);
\r