diff options
author | Carl Worth <cworth@cworth.org> | 2009-11-03 10:32:42 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-11-03 10:32:42 -0800 |
commit | 9c6a01067457a8115300339568b57c8ff2e6a578 (patch) | |
tree | 45a9fa4d8994f41e3d11b2996abd28480ce7bb44 /notmuch.c | |
parent | f2a4c3e565511a543971da378227b8928a48ab36 (diff) |
Hide bodies of message that have already been read.
Also hide all markers.
From here, all we really need for legibility is the following:
* Hide away citations and signatures
* Call out the one-line summary some way, (larger font size?)
* Add nesting for replies
Diffstat (limited to 'notmuch.c')
-rw-r--r-- | notmuch.c | 38 |
1 files changed, 35 insertions, 3 deletions
@@ -952,10 +952,11 @@ show_message_part (GMimeObject *part, int *part_count) const char *filename = g_mime_part_get_filename (GMIME_PART (part)); content_type = g_mime_object_get_content_type (GMIME_OBJECT (part)); - printf ("\fattachment{ ID: %d, Content-type: %s, ", + printf ("\fattachment{ ID: %d, Content-type: %s\n", *part_count, g_mime_content_type_to_string (content_type)); - printf ("Filename: %s ", filename); + printf ("Attachment: %s (%s)\n", filename, + g_mime_content_type_to_string (content_type)); printf ("\fattachment}\n"); return; @@ -977,6 +978,11 @@ show_message_part (GMimeObject *part, int *part_count) if (wrapper) g_mime_data_wrapper_write_to_stream (wrapper, stream); } + else + { + printf ("Non-text part: %s\n", + g_mime_content_type_to_string (content_type)); + } printf ("\fpart}\n"); @@ -1033,6 +1039,25 @@ show_message_body (const char *filename) } static int +_message_is_unread (notmuch_message_t *message) +{ + notmuch_tags_t *tags; + const char *tag; + + for (tags = notmuch_message_get_tags (message); + notmuch_tags_has_more (tags); + notmuch_tags_advance (tags)) + { + tag = notmuch_tags_get (tags); + + if (strcmp (tag, "unread") == 0) + return 1; + } + + return 0; +} + +static int show_command (void *ctx, unused (int argc), unused (char *argv[])) { void *local = talloc_new (ctx); @@ -1042,6 +1067,7 @@ show_command (void *ctx, unused (int argc), unused (char *argv[])) notmuch_messages_t *messages; notmuch_message_t *message; int ret = 0; + int unread; const char *headers[] = { "Subject", "From", "To", "Cc", "Bcc", "Date" @@ -1080,8 +1106,11 @@ show_command (void *ctx, unused (int argc), unused (char *argv[])) notmuch_messages_advance (messages)) { message = notmuch_messages_get (messages); + unread = _message_is_unread (message); - printf ("\fmessage{\n"); + printf ("\fmessage{ ID: %s %s\n", + notmuch_message_get_message_id (message), + unread ? "unread" : ""); printf ("\fheader{\n"); @@ -1095,9 +1124,12 @@ show_command (void *ctx, unused (int argc), unused (char *argv[])) } printf ("\fheader}\n"); + printf ("\fbody{\n"); show_message_body (notmuch_message_get_filename (message)); + printf ("\fbody}\n"); + printf ("\fmessage}\n"); notmuch_message_destroy (message); |