Respect format=flowed and delsp=yes for viewing plain-text messages

This commit is contained in:
Stig Brautaset
2016-12-18 16:16:02 +00:00
parent 05faceeb49
commit cdc2fa1bd8
5 changed files with 137 additions and 1 deletions

View File

@ -422,11 +422,31 @@ append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
" :has-child t" : "");
}
static void
append_sexp_param (GString *gstr, GSList *param)
{
for (;param; param = g_slist_next (param)) {
char *key, *value;
key = param->data;
key = key ? mu_str_escape_c_literal (key, FALSE) : "";
param = g_slist_next (param);
value = param->data;
value = value ? mu_str_escape_c_literal (value, FALSE) : "";
g_string_append_printf (gstr, "(\"%s\" . \"%s\")", key, value);
if (param->next)
g_string_append_c (gstr, ' ');
}
}
static void
append_message_file_parts (GString *gstr, MuMsg *msg, MuMsgOptions opts)
{
const char *str;
GError *err;
const GSList *params;
err = NULL;
@ -445,6 +465,13 @@ append_message_file_parts (GString *gstr, MuMsg *msg, MuMsgOptions opts)
if (str || (str = mu_msg_get_header (msg, "X-Mailer")))
append_sexp_attr (gstr, "user-agent", str);
params = mu_msg_get_body_text_content_type_parameters (msg, opts);
if (params) {
g_string_append_printf (gstr, "\t:body-txt-params (");
append_sexp_param (gstr, params);
g_string_append_printf (gstr, ")\n");
}
append_sexp_body_attr (gstr, "body-txt",
mu_msg_get_body_text(msg, opts));
append_sexp_body_attr (gstr, "body-html",