* mu/mu-cmd.c: enable --decrypt in 'mu view'

This commit is contained in:
djcb
2012-09-12 12:12:48 +03:00
parent 0445d87ab9
commit b8639f63b4

View File

@ -120,8 +120,18 @@ body_or_summary (MuMsg *msg, MuConfig *opts)
color = !opts->nocolor; color = !opts->nocolor;
body = mu_msg_get_body_text (msg, body = mu_msg_get_body_text (msg,
mu_config_get_msg_options(opts)); mu_config_get_msg_options(opts));
if (!body) if (!body) {
if (mu_msg_get_flags (msg) & MU_FLAG_ENCRYPTED) {
color_maybe (MU_COLOR_CYAN);
g_print ("[No body found; "
"message has encrypted parts]\n");
} else {
color_maybe (MU_COLOR_MAGENTA);
g_print ("[No body found]\n");
}
color_maybe (MU_COLOR_DEFAULT);
return; return;
}
if (opts->summary_len != 0) { if (opts->summary_len != 0) {
gchar *summ; gchar *summ;
@ -129,9 +139,9 @@ body_or_summary (MuMsg *msg, MuConfig *opts)
print_field ("Summary", summ, color); print_field ("Summary", summ, color);
g_free (summ); g_free (summ);
} else { } else {
color_maybe (MU_COLOR_YELLOW); mu_util_print_encoded ("%s", body);
mu_util_print_encoded ("\n%s\n", body); if (!g_str_has_suffix (body, "\n"))
color_maybe (MU_COLOR_DEFAULT); g_print ("\n");
} }
} }
@ -237,7 +247,7 @@ mu_cmd_view (MuConfig *opts, GError **err)
g_return_val_if_fail (opts->cmd == MU_CONFIG_CMD_VIEW, g_return_val_if_fail (opts->cmd == MU_CONFIG_CMD_VIEW,
MU_ERROR_INTERNAL); MU_ERROR_INTERNAL);
rv = view_params_valid(opts, err); rv = view_params_valid (opts, err);
if (!rv) if (!rv)
goto leave; goto leave;