talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 79659144fcf27bb7cd71a5ac3e1a7790bb28be06
parent 22a159866b8a9dfdf4aae6d8a10c5ef9e8efc7fc
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Fri,  1 Mar 2019 14:52:22 +0100

Simplify Litehtml plugin's show_mimepart

Diffstat:
Msrc/plugins/litehtml_viewer/lh_viewer.c | 26++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/src/plugins/litehtml_viewer/lh_viewer.c b/src/plugins/litehtml_viewer/lh_viewer.c @@ -83,36 +83,18 @@ static gchar *get_utf8_string(const gchar *string) { return utf8; } -static void lh_show_mimepart(MimeViewer *_viewer, const gchar *infole, +static void lh_show_mimepart(MimeViewer *_viewer, const gchar *infile, MimeInfo *partinfo) { debug_print("LH: show_mimepart\n"); LHViewer *viewer = (LHViewer *)_viewer; + gchar *utf8 = procmime_get_part_as_string(partinfo); - gchar *msgfile = procmime_get_tmp_file_name(partinfo); - debug_print("LH: msgfile '%s'\n", msgfile); - - if (procmime_get_part(msgfile, partinfo) < 0) { - debug_print("LH: couldn't get MIME part file\n"); - g_free(msgfile); - return; - } - - gchar *contents, *utf8; - gsize length; - GError *error = NULL; - if (!g_file_get_contents(msgfile, &contents, &length, &error)) { - g_warning("LiteHTML viewer: couldn't read contents of file '%s': %s", - msgfile, error->message); - g_clear_error(&error); + if (utf8 == NULL) { + g_warning("LH: couldn't get MIME part file\n"); return; - } else { - utf8 = get_utf8_string(contents); - g_free(contents); } - g_free(msgfile); - lh_widget_open_html(viewer->widget, utf8); g_free(utf8); }