mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
Integrate reply_part_content function into reply_part function.
After the last patch to eliminate some redundant code paths in reply_part, the reply_part_content function was only being called once. Disolving the function and integrating its contents into the reply_part function makes things a little simpler, and frees up some name space that will be needed in the next patch.
This commit is contained in:
parent
03ac922c4b
commit
5659d42231
1 changed files with 23 additions and 29 deletions
|
@ -37,34 +37,6 @@ static const notmuch_show_format_t format_reply = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static void
|
||||
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));
|
||||
wrapper = g_mime_part_get_content_object (GMIME_PART (part));
|
||||
if (wrapper && stream_filter)
|
||||
g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
|
||||
if (stream_filter)
|
||||
g_object_unref(stream_filter);
|
||||
if (stream_stdout)
|
||||
g_object_unref(stream_stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
show_reply_headers (GMimeMessage *message)
|
||||
{
|
||||
|
@ -94,7 +66,29 @@ reply_part (GMimeObject *part,
|
|||
if (g_mime_content_type_is_type (content_type, "text", "*") &&
|
||||
!g_mime_content_type_is_type (content_type, "text", "html"))
|
||||
{
|
||||
reply_part_content (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));
|
||||
wrapper = g_mime_part_get_content_object (GMIME_PART (part));
|
||||
if (wrapper && stream_filter)
|
||||
g_mime_data_wrapper_write_to_stream (wrapper, stream_filter);
|
||||
if (stream_filter)
|
||||
g_object_unref(stream_filter);
|
||||
if (stream_stdout)
|
||||
g_object_unref(stream_stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue