X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.c;h=718aec9a66e7c9b6927d488d99e278949475261f;hp=581592c4f926aa1c391438a0c2d65fb766da3c95;hb=9c6a01067457a8115300339568b57c8ff2e6a578;hpb=f2a4c3e565511a543971da378227b8928a48ab36 diff --git a/notmuch.c b/notmuch.c index 581592c4..718aec9a 100644 --- a/notmuch.c +++ b/notmuch.c @@ -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"); @@ -1032,6 +1038,25 @@ show_message_body (const char *filename) return ret; } +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[])) { @@ -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);