Commit 5cc65400 5cc65400cb88bb4554d1f7b7ca66bd49a90fa5bd by Sergey Poznyakoff

(mail_from0): New function shared between from.c and headers.c

1 parent e7336cfd
......@@ -27,7 +27,13 @@ mail_from (int argc, char **argv)
if (argc > 1)
return util_msglist_command (mail_from, argc, argv, 0);
else
{
return mail_from0 (cursor, 1);
return 1;
}
int
mail_from0 (int msgno, int verbose)
{
message_t msg;
header_t hdr = NULL;
envelope_t env;
......@@ -42,7 +48,8 @@ mail_from (int argc, char **argv)
struct tm tm;
mu_timezone tz;
if (util_get_message (mbox, cursor, &msg, 1))
if (util_get_message (mbox, msgno, &msg,
MSG_NODELETED|(verbose ? 0 : MSG_SILENT)))
return 1;
message_get_header (msg, &hdr);
......@@ -106,13 +113,11 @@ mail_from (int argc, char **argv)
fromp = from ? from : "";
subjp = subj ? subj : fromp;
fprintf (ofile, "%c%c%4d %-18.18s %-16.16s %s %.*s\n",
cursor == realcursor ? '>' : ' ', cflag, cursor,
msgno == realcursor ? '>' : ' ', cflag, msgno,
fromp, date, st, (subjl < 0) ? 0 : subjl, subjp);
free (from);
free (subj);
return 0;
}
return 1;
}
......