Changed output format.
Showing
1 changed file
with
36 additions
and
5 deletions
... | @@ -25,15 +25,22 @@ int | ... | @@ -25,15 +25,22 @@ int |
25 | mail_from (int argc, char **argv) | 25 | mail_from (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | return util_msglist_command (mail_from, argc, argv); | 28 | return util_msglist_command (mail_from, argc, argv, 0); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | message_t msg; | 31 | message_t msg; |
32 | header_t hdr; | 32 | header_t hdr; |
33 | envelope_t env; | ||
34 | attribute_t attr; | ||
33 | char *from, *subj; | 35 | char *from, *subj; |
34 | int froml, subjl; | 36 | int froml, subjl; |
35 | char format[64]; | 37 | char date[80], st[10]; |
36 | int cols = util_getcols () - 6; | 38 | int cols = util_getcols () - 6; |
39 | int flags, cflag; | ||
40 | size_t m_size = 0, m_lines = 0; | ||
41 | const char *p; | ||
42 | struct tm tm; | ||
43 | mu_timezone tz; | ||
37 | 44 | ||
38 | if (mailbox_get_message (mbox, cursor, &msg) != 0) | 45 | if (mailbox_get_message (mbox, cursor, &msg) != 0) |
39 | return 1; | 46 | return 1; |
... | @@ -60,9 +67,33 @@ mail_from (int argc, char **argv) | ... | @@ -60,9 +67,33 @@ mail_from (int argc, char **argv) |
60 | header_get_value (hdr, MU_HEADER_FROM, from, froml, NULL); | 67 | header_get_value (hdr, MU_HEADER_FROM, from, froml, NULL); |
61 | header_get_value (hdr, MU_HEADER_SUBJECT, subj, subjl, NULL); | 68 | header_get_value (hdr, MU_HEADER_SUBJECT, subj, subjl, NULL); |
62 | 69 | ||
63 | snprintf (format, 64, "%%c%%2d %%-%ds%%-%ds\n", froml, subjl); | 70 | message_get_attribute (msg, &attr); |
64 | fprintf (ofile, format, cursor == realcursor ? '>' : ' ', cursor, | 71 | attribute_get_flags (attr, &flags); |
65 | from, subj); | 72 | |
73 | if (attribute_is_userflag(attr, MAIL_ATTRIBUTE_MBOXED)) | ||
74 | cflag = 'M'; | ||
75 | else if (attribute_is_userflag(attr, MAIL_ATTRIBUTE_SAVED)) | ||
76 | cflag = '*'; | ||
77 | else if (flags == MU_ATTRIBUTE_RECENT) /*FIXME*/ | ||
78 | cflag = 'N'; | ||
79 | else if (flags & MU_ATTRIBUTE_READ) | ||
80 | cflag = 'R'; | ||
81 | else | ||
82 | cflag = 'U'; | ||
83 | |||
84 | message_get_envelope (msg, &env); | ||
85 | envelope_date (env, date, sizeof (date), NULL); | ||
86 | p = date; | ||
87 | if (mu_parse_ctime_date_time(&p, &tm, &tz) == 0) | ||
88 | strftime (date, sizeof(date), "%a %b %e %H:%M", &tm); | ||
89 | |||
90 | message_size (msg, &m_size); | ||
91 | message_lines (msg, &m_lines); | ||
92 | |||
93 | snprintf (st, sizeof(st), "%3ld/%-5ld", m_lines, m_size); | ||
94 | fprintf (ofile, "%c%c%4d %-18.18s %-16.16s %s %12.12s\n", | ||
95 | cursor == realcursor ? '>' : ' ', cflag, cursor, | ||
96 | from, date, st, subj); | ||
66 | 97 | ||
67 | free (from); | 98 | free (from); |
68 | free (subj); | 99 | free (subj); | ... | ... |
-
Please register or sign in to post a comment