/* a summary_len of 0 mean 'don't show summary, show body */ static void body_or_summary (MuMsg *msg, MuConfig *opts) { const char *body; gboolean color; color = !opts->nocolor; body = mu_msg_get_body_text (msg, mu_config_get_msg_options(opts) | MU_MSG_OPTION_CONSOLE_PASSWORD); 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; } if (opts->summary_len != 0) { gchar *summ; summ = mu_str_summarize (body, opts->summary_len); print_field ("Summary", summ, color); g_free (summ); } else { mu_util_print_encoded ("%s", body); if (!g_str_has_suffix (body, "\n")) g_print ("\n"); } }
static void print_summary (MuMsg *msg, MuConfig *opts) { const char* body; char *summ; MuMsgOptions msgopts; msgopts = mu_config_get_msg_options (opts); body = mu_msg_get_body_text(msg, msgopts); if (body) summ = mu_str_summarize (body, (unsigned)opts->summary_len); else summ = NULL; g_print ("Summary: "); mu_util_fputs_encoded (summ ? summ : "<none>", stdout); g_print ("\n"); g_free (summ); }
static void body_or_summary (MuMsg *msg, gboolean summary, gboolean color) { const char* field; const int SUMMARY_LEN = 5; field = mu_msg_get_body_text (msg); if (!field) return; /* no body -- nothing more to do */ if (summary) { gchar *summ; summ = mu_str_summarize (field, SUMMARY_LEN); print_field ("Summary", summ, color); g_free (summ); } else { color_maybe (MU_COLOR_YELLOW); mu_util_print_encoded ("\n%s\n", field); color_maybe (MU_COLOR_DEFAULT); } }
/* a summary_len of 0 mean 'don't show summary, show body */ static void body_or_summary (MuMsg *msg, MuConfig *opts) { const char *body; gboolean color; color = !opts->nocolor; body = mu_msg_get_body_text (msg, mu_config_get_msg_options(opts)); if (!body) return; if (opts->summary_len != 0) { gchar *summ; summ = mu_str_summarize (body, opts->summary_len); print_field ("Summary", summ, color); g_free (summ); } else { color_maybe (MU_COLOR_YELLOW); mu_util_print_encoded ("\n%s\n", body); color_maybe (MU_COLOR_DEFAULT); } }