Re: [notmuch] [PATCH] Add tests to configure script to detect strndup and getline
[notmuch-archives.git] / ad / 65c3647a191e6707fc0ade26381239f34f31ca
1 Return-Path: <keithp@keithp.com>\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 D8CA8431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 11:56:24 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id aRx-6oOVOCf5 for <notmuch@notmuchmail.org>;\r
11         Wed, 18 Nov 2009 11:56:23 -0800 (PST)\r
12 Received: from keithp.com (home.keithp.com [63.227.221.253])\r
13         by olra.theworths.org (Postfix) with ESMTP id 12328431FAE\r
14         for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 11:56:23 -0800 (PST)\r
15 Received: from localhost (localhost [127.0.0.1])\r
16         by keithp.com (Postfix) with ESMTP id 150DEB9404C\r
17         for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 11:56:21 -0800 (PST)\r
18 X-Virus-Scanned: Debian amavisd-new at keithp.com\r
19 Received: from keithp.com ([127.0.0.1])\r
20         by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024)\r
21         with LMTP id wCZMnIzscRaV; Wed, 18 Nov 2009 11:56:15 -0800 (PST)\r
22 Received: by keithp.com (Postfix, from userid 1033)\r
23         id 47B3DB9402F; Wed, 18 Nov 2009 11:56:15 -0800 (PST)\r
24 Received: from koto.keithp.com (localhost [127.0.0.1])\r
25         by keithp.com (Postfix) with ESMTP id 3B1A1B88003;\r
26         Wed, 18 Nov 2009 11:56:15 -0800 (PST)\r
27 Received: by koto.keithp.com (Postfix, from userid 1488)\r
28         id CE9901581A5; Wed, 18 Nov 2009 11:56:14 -0800 (PST)\r
29 From: Keith Packard <keithp@keithp.com>\r
30 To: notmuch@notmuchmail.org\r
31 Date: Wed, 18 Nov 2009 11:56:13 -0800\r
32 Message-Id: <1258574173-19911-1-git-send-email-keithp@keithp.com>\r
33 X-Mailer: git-send-email 1.6.5.2\r
34 Subject: [notmuch] [PATCH] Filter out carriage-returns in show and reply\r
35         output.\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.12\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Wed, 18 Nov 2009 19:56:25 -0000\r
49 \r
50 Thanks, windows mail clients.\r
51 \r
52 Signed-off-by: Keith Packard <keithp@keithp.com>\r
53 ---\r
54  gmime-filter-reply.c |    7 ++++---\r
55  notmuch-show.c       |   21 +++++++++++++++------\r
56  2 files changed, 19 insertions(+), 9 deletions(-)\r
57 \r
58 diff --git a/gmime-filter-reply.c b/gmime-filter-reply.c\r
59 index 3e298e1..b269db4 100644\r
60 --- a/gmime-filter-reply.c\r
61 +++ b/gmime-filter-reply.c\r
62 @@ -130,8 +130,9 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,\r
63                                 reply->saw_nl = TRUE;\r
64                         else\r
65                                 reply->saw_nl = FALSE;\r
66 -\r
67 -                       *outptr++ = *inptr++;\r
68 +                       if (*inptr != '\r')\r
69 +                               *outptr++ = *inptr;\r
70 +                       inptr++;\r
71                 }\r
72         } else {\r
73                 g_mime_filter_set_size (filter, inlen + 1, FALSE);\r
74 @@ -150,7 +151,7 @@ filter_filter (GMimeFilter *filter, char *inbuf, size_t inlen, size_t prespace,\r
75                                 else\r
76                                         *outptr++ = *inptr;\r
77                                 reply->saw_angle = FALSE;\r
78 -                       } else {\r
79 +                       } else if (*inptr != '\r') {\r
80                                 if (*inptr == '\n')\r
81                                         reply->saw_nl = TRUE;\r
82                                 *outptr++ = *inptr;\r
83 diff --git a/notmuch-show.c b/notmuch-show.c\r
84 index 7749dbc..4c377e1 100644\r
85 --- a/notmuch-show.c\r
86 +++ b/notmuch-show.c\r
87 @@ -99,14 +99,23 @@ show_part (GMimeObject *part, int *part_count)\r
88      if (g_mime_content_type_is_type (content_type, "text", "*") &&\r
89         !g_mime_content_type_is_type (content_type, "text", "html"))\r
90      {\r
91 -       GMimeStream *stream = g_mime_stream_file_new (stdout);\r
92 -       g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream), FALSE);\r
93 +       GMimeStream *stream_stdout = g_mime_stream_file_new (stdout);\r
94 +       GMimeStream *stream_filter = NULL;\r
95 +       \r
96 +       if (stream_stdout) {\r
97 +           g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
98 +           stream_filter = g_mime_stream_filter_new(stream_stdout);\r
99 +           g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),\r
100 +                                    g_mime_filter_crlf_new(FALSE, FALSE));\r
101 +       }\r
102  \r
103         wrapper = g_mime_part_get_content_object (GMIME_PART (part));\r
104 -       if (wrapper && stream)\r
105 -           g_mime_data_wrapper_write_to_stream (wrapper, stream);\r
106 -       if (stream)\r
107 -           g_object_unref(stream);\r
108 +       if (wrapper && stream_filter)\r
109 +           g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);\r
110 +       if (stream_filter)\r
111 +           g_object_unref(stream_filter);\r
112 +       if (stream_stdout)\r
113 +           g_object_unref(stream_stdout);\r
114      }\r
115      else\r
116      {\r
117 -- \r
118 1.6.5.2\r
119 \r