/* %d */ static char * hdr_date (struct header_call_args *args, void *data) { char date[80]; mu_header_t hdr; mu_message_get_header (args->msg, &hdr); date[0] = 0; if (mailvar_get (NULL, "datefield", mailvar_type_boolean, 0) == 0 && mu_header_get_value (hdr, MU_HEADER_DATE, date, sizeof (date), NULL) == 0) { time_t t; if (mu_parse_date (date, &t, NULL) == 0) strftime (date, sizeof(date), "%a %b %e %H:%M", localtime (&t)); else date[0] = 0; } if (date[0] == 0) { const char *p; struct tm tm; mu_timezone tz; mu_envelope_t env; mu_message_get_envelope (args->msg, &env); if (mu_envelope_sget_date (env, &p) == 0 && mu_parse_ctime_date_time (&p, &tm, &tz) == 0) strftime (date, sizeof(date), "%a %b %e %H:%M", &tm); } return header_buf_string (args, date); }
int print_envelope (msgset_t *mspec, mu_message_t msg, void *data) { int status; mu_envelope_t env = NULL; const char *sender = NULL, *date = NULL; status = mu_message_get_envelope (msg, &env); if (status) { mu_error (_("%lu: Cannot get envelope"), (unsigned long) mspec->msg_part[0]); } else { mu_envelope_sget_sender (env, &sender); mu_envelope_sget_date (env, &date); if (data) mu_printf ("%s ", (char*) data); mu_printf ("%s %s", sender, date); } return 0; }