static void each_part_show (MuMsg *msg, MuMsgPart *part, gboolean color) { /* index */ g_print (" %u ", part->index); /* filename */ color_maybe (MU_COLOR_GREEN); { gchar *fname; fname = mu_msg_part_get_filename (part, FALSE); mu_util_fputs_encoded (fname ? fname : "<none>", stdout); g_free (fname); } /* content-type */ color_maybe (MU_COLOR_BLUE); mu_util_print_encoded ( " %s/%s ", part->type ? part->type : "<none>", part->subtype ? part->subtype : "<none>"); /* /\* disposition *\/ */ color_maybe (MU_COLOR_MAGENTA); mu_util_print_encoded ("[%s]", disp_str(part->part_type)); /* size */ if (part->size > 0) { color_maybe (MU_COLOR_CYAN); g_print (" (%s)", mu_str_size_s (part->size)); } color_maybe (MU_COLOR_DEFAULT); fputs ("\n", stdout); }
static void each_contact (const char *email, const char *name, gboolean personal, time_t tstamp, ECData *ecdata) { if (ecdata->personal && !personal) return; if (tstamp < ecdata->after) return; switch (ecdata->format) { case MU_CONFIG_FORMAT_MUTT_ALIAS: each_contact_mutt_alias (email, name); break; case MU_CONFIG_FORMAT_MUTT_AB: mu_util_print_encoded ("%s\t%s\t\n", email, name ? name : ""); break; case MU_CONFIG_FORMAT_WL: each_contact_wl (email, name); break; case MU_CONFIG_FORMAT_ORG_CONTACT: each_contact_org_contact (email, name); break; case MU_CONFIG_FORMAT_BBDB: each_contact_bbdb (email, name, tstamp); break; case MU_CONFIG_FORMAT_CSV: mu_util_print_encoded ("%s,%s\n", name ? name : "", email); break; default: print_plain (email, name, ecdata->color); } }
static void each_part_show (MuMsg *msg, MuMsgPart *part, gboolean color) { /* index */ g_print (" %u ", part->index); /* filename */ color_maybe (MU_COLOR_GREEN); mu_util_fputs_encoded (part->file_name ? part->file_name : "<none>", stdout); /* content-type */ color_maybe (MU_COLOR_BLUE); mu_util_print_encoded ( " %s/%s ", part->type ? part->type : "<none>", part->subtype ? part->subtype : "<none>"); /* disposition */ color_maybe (MU_COLOR_MAGENTA); mu_util_print_encoded ( "[%s]", part->disposition ? part->disposition : "<none>"); /* size */ if (part->size > 0) { color_maybe (MU_COLOR_CYAN); g_print (" (%s)", mu_str_size_s (part->size)); } color_maybe (MU_COLOR_DEFAULT); fputs ("\n", stdout); }
/* 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 each_contact_org_contact (const char *email, const char *name) { if (name) mu_util_print_encoded ( "* %s\n:PROPERTIES:\n:EMAIL: %s\n:END:\n\n", name, email); }
static void each_contact_wl (const char *email, const char *name) { gchar *nick; if (!name) return; nick = mu_str_guess_nick (name); mu_util_print_encoded ("%s \"%s\" \"%s\"\n", email, nick, name); g_free (nick); }
static void each_contact_mutt_alias (const char *email, const char *name) { gchar *nick; if (!name) return; nick = mu_str_guess_nick (name); mu_util_print_encoded ("alias %s %s <%s>\n", nick, name, email); g_free (nick); }
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); } }