From: Johan Parin <johanparin@gmail.com>
To: notmuch@notmuchmail.org
Cc: Johan Parin <johan.parin@gmail.com>
Subject: [PATCH] Display extra headers for emacs-mua - return all headers
Date: Sat, 23 Nov 2019 00:07:30 +0100 [thread overview]
Message-ID: <20191122230730.35712-3-johan.parin@gmail.com> (raw)
In-Reply-To: <20191122230730.35712-1-johan.parin@gmail.com>
Modify format_headers_sprinter so that it returns all headers in the
sexp, instead of a fixed set of headers.
This is required in order for the elisp variable
`notmuch-message-headers' to work.
See this bug report:
https://notmuchmail.org/pipermail/notmuch/2017/026069.html
---
notmuch-show.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/notmuch-show.c b/notmuch-show.c
index 21792a57..6bd1cf73 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -255,6 +255,37 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
sp->string (sp, g_mime_message_get_date_string (sp, message));
}
+ if (!reply) {
+ GMimeHeaderList *header_list;
+ GMimeHeader *header;
+ int header_count;
+ /* Headers requiring some special treatment in formatting */
+ const char* special_headers[] = {
+ "Subject", "From", "To", "Cc", "Bcc", "Reply-To", "In-reply-to",
+ "References", "Date"};
+ bool special;
+
+ header_list = g_mime_object_get_header_list (GMIME_OBJECT(message));
+ header_count = g_mime_header_list_get_count(header_list);
+
+ for (int i = 0; i < header_count; i++) {
+ header = g_mime_header_list_get_header_at(header_list, i);
+
+ special = false;
+ for (int k = 0; k < (int)ARRAY_SIZE(special_headers); k++)
+ if (!STRNCMP_LITERAL(g_mime_header_get_name(header),
+ special_headers[k])) {
+ special = true;
+ break;
+ }
+ if (special)
+ continue;
+
+ sp->map_key (sp, g_mime_header_get_name(header));
+ sp->string (sp, g_mime_header_get_value(header));
+ }
+ }
+
sp->end (sp);
talloc_free (local);
}
--
2.21.0 (Apple Git-122)
prev parent reply other threads:[~2019-11-22 23:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-22 23:07 Display extra headers for emacs-mua 2 new patches Johan Parin
2019-11-22 23:07 ` [PATCH] Display extra headers for emacs-mua - cmd line option Johan Parin
2019-11-23 9:44 ` Johan Parin
2019-11-22 23:07 ` Johan Parin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191122230730.35712-3-johan.parin@gmail.com \
--to=johanparin@gmail.com \
--cc=johan.parin@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).