[PATCH v3 0/3] Clean up reply's encoding story

2013-08-17 Thread David Bremner
Jani Nikula  writes:
>
> 'make test' now gives me:
>
>  FAIL   Reply with RFC 2047-encoded headers
>   --- reply.12.expected   2013-08-17 11:57:31.047782938 +
>   +++ reply.12.output 2013-08-17 11:57:31.047782938 +
>   @@ -1,5 +1,5 @@
>From: Notmuch Test Suite 
>   -Subject: Re: =?iso-8859-1?b?4N/n?=
>   +Subject: Re: =?iso-8859-1?B?4N/n?=
>To: =?UTF-8?b?4piD?= 
>In-Reply-To: 
>References: 
>
> I'm using libgmime 2.6.16-1 from Debian testing.
>

Oh hmm. now that I upgrade to 2.6.16-1 I see the same thing.  It seems
like something changed in gmime. I think the RFC specifies that ?b is
equivalent to ?B as an encoding marker, so maybe we should normalize
before comparing?

d


[PATCH v3 0/3] Clean up reply's encoding story

2013-08-17 Thread Jani Nikula
On Sat, 17 Aug 2013, David Bremner  wrote:
> Austin Clements  writes:
>
>> This is v3 of id:1376587658-19202-1-git-send-email-amdragon at mit.edu.
>> This addresses Jani's comment in id:87k3jl3ehe.fsf at nikula.org by
>> treating errors while retrieving the original message's References
>> header as if the original message didn't have a References header.  It
>> also adds a comment suggested by Jani on IRC.  The diff from v2 is
>> below.
>
> pushed, 

'make test' now gives me:

 FAIL   Reply with RFC 2047-encoded headers
--- reply.12.expected   2013-08-17 11:57:31.047782938 +
+++ reply.12.output 2013-08-17 11:57:31.047782938 +
@@ -1,5 +1,5 @@
 From: Notmuch Test Suite 
-Subject: Re: =?iso-8859-1?b?4N/n?=
+Subject: Re: =?iso-8859-1?B?4N/n?=
 To: =?UTF-8?b?4piD?= 
 In-Reply-To: 
 References: 

I'm using libgmime 2.6.16-1 from Debian testing.


BR,
Jani.


[PATCH v3 0/3] Clean up reply's encoding story

2013-08-17 Thread David Bremner
Austin Clements  writes:

> This is v3 of id:1376587658-19202-1-git-send-email-amdragon at mit.edu.
> This addresses Jani's comment in id:87k3jl3ehe.fsf at nikula.org by
> treating errors while retrieving the original message's References
> header as if the original message didn't have a References header.  It
> also adds a comment suggested by Jani on IRC.  The diff from v2 is
> below.

pushed, 

d


[PATCH v3 0/3] Clean up reply's encoding story

2013-08-17 Thread Tomi Ollila
On Fri, Aug 16 2013, Jani Nikula  wrote:

> On Fri, 16 Aug 2013, Austin Clements  wrote:
>> This is v3 of id:1376587658-19202-1-git-send-email-amdragon at mit.edu.
>> This addresses Jani's comment in id:87k3jl3ehe.fsf at nikula.org by
>> treating errors while retrieving the original message's References
>> header as if the original message didn't have a References header.  It
>> also adds a comment suggested by Jani on IRC.  The diff from v2 is
>> below.
>
> The series LGTM, and I in particular welcome the diffstat in patch 3!

The series LGTM, and I in particular welcome the diffstat in patch 3!

> BR,
> Jani.

Tomi

>
>
>>
>> diff --git a/notmuch-reply.c b/notmuch-reply.c
>> index bfd0f51..ac46d02 100644
>> --- a/notmuch-reply.c
>> +++ b/notmuch-reply.c
>> @@ -31,6 +31,7 @@ show_reply_headers (GMimeMessage *message)
>>  stream_stdout = g_mime_stream_file_new (stdout);
>>  if (stream_stdout) {
>>  g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
>> +/* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
>>  g_mime_object_write_to_stream (GMIME_OBJECT(message), stream_stdout);
>>  g_object_unref(stream_stdout);
>>  }
>> @@ -526,14 +527,15 @@ create_reply_message(void *ctx,
>>"In-Reply-To", in_reply_to);
>>  
>>  orig_references = notmuch_message_get_header (message, "references");
>> -if (orig_references) {
>> -references = talloc_asprintf (ctx, "%s%s%s",
>> -  *orig_references ? orig_references : "",
>> -  *orig_references ? " " : "",
>> -  in_reply_to);
>> -g_mime_object_set_header (GMIME_OBJECT (reply),
>> -  "References", references);
>> -}
>> +if (!orig_references)
>> +/* Treat errors like missing References headers. */
>> +orig_references = "";
>> +references = talloc_asprintf (ctx, "%s%s%s",
>> +  *orig_references ? orig_references : "",
>> +  *orig_references ? " " : "",
>> +  in_reply_to);
>> +g_mime_object_set_header (GMIME_OBJECT (reply),
>> +  "References", references);
>>  
>>  return reply;
>>  }
>>
>>
>> ___
>> notmuch mailing list
>> notmuch at notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3 0/3] Clean up reply's encoding story

2013-08-16 Thread Jani Nikula
On Fri, 16 Aug 2013, Austin Clements  wrote:
> This is v3 of id:1376587658-19202-1-git-send-email-amdragon at mit.edu.
> This addresses Jani's comment in id:87k3jl3ehe.fsf at nikula.org by
> treating errors while retrieving the original message's References
> header as if the original message didn't have a References header.  It
> also adds a comment suggested by Jani on IRC.  The diff from v2 is
> below.

The series LGTM, and I in particular welcome the diffstat in patch 3!

BR,
Jani.


>
> diff --git a/notmuch-reply.c b/notmuch-reply.c
> index bfd0f51..ac46d02 100644
> --- a/notmuch-reply.c
> +++ b/notmuch-reply.c
> @@ -31,6 +31,7 @@ show_reply_headers (GMimeMessage *message)
>  stream_stdout = g_mime_stream_file_new (stdout);
>  if (stream_stdout) {
>   g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
> + /* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
>   g_mime_object_write_to_stream (GMIME_OBJECT(message), stream_stdout);
>   g_object_unref(stream_stdout);
>  }
> @@ -526,14 +527,15 @@ create_reply_message(void *ctx,
> "In-Reply-To", in_reply_to);
>  
>  orig_references = notmuch_message_get_header (message, "references");
> -if (orig_references) {
> - references = talloc_asprintf (ctx, "%s%s%s",
> -   *orig_references ? orig_references : "",
> -   *orig_references ? " " : "",
> -   in_reply_to);
> - g_mime_object_set_header (GMIME_OBJECT (reply),
> -   "References", references);
> -}
> +if (!orig_references)
> + /* Treat errors like missing References headers. */
> + orig_references = "";
> +references = talloc_asprintf (ctx, "%s%s%s",
> +   *orig_references ? orig_references : "",
> +   *orig_references ? " " : "",
> +   in_reply_to);
> +g_mime_object_set_header (GMIME_OBJECT (reply),
> +   "References", references);
>  
>  return reply;
>  }
>
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3 0/3] Clean up reply's encoding story

2013-08-16 Thread Austin Clements
This is v3 of id:1376587658-19202-1-git-send-email-amdragon at mit.edu.
This addresses Jani's comment in id:87k3jl3ehe.fsf at nikula.org by
treating errors while retrieving the original message's References
header as if the original message didn't have a References header.  It
also adds a comment suggested by Jani on IRC.  The diff from v2 is
below.

diff --git a/notmuch-reply.c b/notmuch-reply.c
index bfd0f51..ac46d02 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -31,6 +31,7 @@ show_reply_headers (GMimeMessage *message)
 stream_stdout = g_mime_stream_file_new (stdout);
 if (stream_stdout) {
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
+   /* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
g_mime_object_write_to_stream (GMIME_OBJECT(message), stream_stdout);
g_object_unref(stream_stdout);
 }
@@ -526,14 +527,15 @@ create_reply_message(void *ctx,
  "In-Reply-To", in_reply_to);

 orig_references = notmuch_message_get_header (message, "references");
-if (orig_references) {
-   references = talloc_asprintf (ctx, "%s%s%s",
- *orig_references ? orig_references : "",
- *orig_references ? " " : "",
- in_reply_to);
-   g_mime_object_set_header (GMIME_OBJECT (reply),
- "References", references);
-}
+if (!orig_references)
+   /* Treat errors like missing References headers. */
+   orig_references = "";
+references = talloc_asprintf (ctx, "%s%s%s",
+ *orig_references ? orig_references : "",
+ *orig_references ? " " : "",
+ in_reply_to);
+g_mime_object_set_header (GMIME_OBJECT (reply),
+ "References", references);

 return reply;
 }