]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-reply.c
lib: Treat NULL as a valid (and empty) notmuch_filenames_t iterator.
[notmuch] / notmuch-reply.c
index e85568c082ef8d519c1e391221e29867fc02d2aa..0cda72dcf05488be170faca9bd9a6e63f6c3e054 100644 (file)
@@ -39,11 +39,17 @@ reply_part_content (GMimeObject *part)
 {
     GMimeStream *stream_stdout = NULL, *stream_filter = NULL;
     GMimeDataWrapper *wrapper;
+    const char *charset;
 
+    charset = g_mime_object_get_content_type_parameter (part, "charset");
     stream_stdout = g_mime_stream_file_new (stdout);
     if (stream_stdout) {
        g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
        stream_filter = g_mime_stream_filter_new(stream_stdout);
+        if (charset) {
+          g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
+                                   g_mime_filter_charset_new(charset, "UTF-8"));
+        }
     }
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
                             g_mime_filter_reply_new(TRUE));
@@ -310,15 +316,19 @@ notmuch_reply_format_headers_only(void *ctx, notmuch_config_t *config, notmuch_q
        in_reply_to = talloc_asprintf (ctx, "<%s>",
                             notmuch_message_get_message_id (message));
 
+        g_mime_object_set_header (GMIME_OBJECT (reply),
+                                 "In-Reply-To", in_reply_to);
+
+
        orig_references = notmuch_message_get_header (message, "references");
 
-       /* We print References first because git format-patch treats it specially.
-        * Git uses the first entry of References to create In-Reply-To.
+       /* We print In-Reply-To followed by References because git format-patch treats them
+         * specially.  Git does not interpret the other headers specially
         */
        references = talloc_asprintf (ctx, "%s%s%s",
-                                     in_reply_to,
                                      orig_references ? orig_references : "",
-                                     orig_references ? " " : "");
+                                     orig_references ? " " : "",
+                                     in_reply_to);
        g_mime_object_set_header (GMIME_OBJECT (reply),
                                  "References", references);