unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v3 0/3] Clean up reply's encoding story
@ 2013-08-16 15:35 Austin Clements
  2013-08-16 15:35 ` [PATCH v3 1/3] reply: Test replying to messages with RFC 2047-encoded headers Austin Clements
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Austin Clements @ 2013-08-16 15:35 UTC (permalink / raw)
  To: notmuch; +Cc: tomi.ollila

This is v3 of id:1376587658-19202-1-git-send-email-amdragon@mit.edu.
This addresses Jani's comment in id:87k3jl3ehe.fsf@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;
 }

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-17 15:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-16 15:35 [PATCH v3 0/3] Clean up reply's encoding story Austin Clements
2013-08-16 15:35 ` [PATCH v3 1/3] reply: Test replying to messages with RFC 2047-encoded headers Austin Clements
2013-08-16 15:35 ` [PATCH v3 2/3] reply: Remove extraneous space from generated References Austin Clements
2013-08-16 15:35 ` [PATCH v3 3/3] reply: Use RFC 2822/MIME wholly for text format template Austin Clements
2013-08-16 15:45 ` [PATCH v3 0/3] Clean up reply's encoding story Jani Nikula
2013-08-16 20:27   ` Tomi Ollila
2013-08-17  7:07 ` David Bremner
2013-08-17 12:03   ` Jani Nikula
2013-08-17 15:21     ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).