diff options
| author | Carl Worth <cworth@cworth.org> | 2009-10-29 08:51:12 -0700 |
|---|---|---|
| committer | Carl Worth <cworth@cworth.org> | 2009-10-29 08:51:12 -0700 |
| commit | bf78a89196b251c2465f6cefa8198f22c87ff23d (patch) | |
| tree | 3728d25ec1ec9317cb4aca314ab7f8fa932f15d4 /message.cc | |
| parent | b39ebca8c97fb19c52e46a2b9565c2d9fa0707d0 (diff) | |
notmuch show: Initial implementation (headers only)
We're using a delimiter syntax that Keith is optimistic about
being able to easily parse in emacs. Note: We're not escaping
any occurrence of the delimiters in the message yet, so we'll
need to fix that.
Diffstat (limited to 'message.cc')
| -rw-r--r-- | message.cc | 43 |
1 files changed, 28 insertions, 15 deletions
@@ -232,26 +232,39 @@ notmuch_message_get_message_id (notmuch_message_t *message) return message->message_id; } -const char * -_notmuch_message_get_subject (notmuch_message_t *message) +static void +_notmuch_message_ensure_message_file (notmuch_message_t *message) { - if (! message->message_file) { - notmuch_message_file_t *message_file; - const char *filename; + const char *filename; - filename = notmuch_message_get_filename (message); - if (unlikely (filename == NULL)) - return NULL; + if (message->message_file) + return; - message_file = _notmuch_message_file_open_ctx (message, filename); - if (unlikely (message_file == NULL)) - return NULL; + filename = notmuch_message_get_filename (message); + if (unlikely (filename == NULL)) + return; - message->message_file = message_file; - } + message->message_file = _notmuch_message_file_open_ctx (message, filename); +} + +const char * +notmuch_message_get_header (notmuch_message_t *message, const char *header) +{ + _notmuch_message_ensure_message_file (message); + if (message->message_file == NULL) + return NULL; + + return notmuch_message_file_get_header (message->message_file, header); +} + +const char * +notmuch_message_get_all_headers (notmuch_message_t *message) +{ + _notmuch_message_ensure_message_file (message); + if (message->message_file == NULL) + return NULL; - return notmuch_message_file_get_header (message->message_file, - "subject"); + return notmuch_message_file_get_all_headers (message->message_file); } const char * |
