From: Amin Bandali <aminb@gnu.org>
To: david@tethera.net
Subject: Re: [BUG] Custom headers in `notmuch-message-headers` are broken
Date: Mon, 16 Jul 2018 17:51:09 -0400 [thread overview]
Message-ID: <87muuqsvci.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87tvwd3bx2.fsf@tethera.net>
I got bitten by this today.
I only had a brief look at the format_headers_sprinter function
in notmuch-show.c. Would you, David, or anyone else be able to
point out if the following makes sense, for generalizing
format_headers_sprinter to handle any arbitrary headers?
I saw this bit near the bottom of that function:
--8<---------------cut here---------------start------------->8---
if (reply) {
sp->map_key (sp, "In-reply-to");
sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), "In-reply-to"));
sp->map_key (sp, "References");
sp->string (sp, g_mime_object_get_header (GMIME_OBJECT (message), "References"));
}
--8<---------------cut here---------------end--------------->8---
So I had a look at GMimeObject's docs on GNOME.org [0], and saw
g_mime_object_get_header_list, which returns a GMimeHeaderList*
list of headers [1], which seems to be what we're looking for.
From there, we'd walk over 0..(g_mime_header_list_get_count-1)
indices and use g_mime_header_list_get_header_at to get each
header, and pass it to g_mime_header_get_name to get the name
which we'll pass to sp->map_key and also use to get its value
from g_mime_object_get_header.
Does that make sense?
[0]: https://developer.gnome.org/gmime/stable/GMimeObject.html
[1]: https://developer.gnome.org/gmime/stable/GMimeHeaderList.html
-amin
next prev parent reply other threads:[~2018-07-16 23:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-26 11:47 [BUG] Custom headers in `notmuch-message-headers` are broken Jan Malakhovski
2017-12-26 12:34 ` David Bremner
2018-07-16 21:51 ` Amin Bandali [this message]
2018-07-26 4:33 ` David Bremner
2018-07-26 6:46 ` Jan Malakhovski
2018-07-26 6:55 ` David Bremner
2018-10-20 5:09 ` Leo Gaspard
2022-03-03 14:06 ` David Bremner
2024-04-20 9:07 ` Herbert Valerio Riedel
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=87muuqsvci.fsf@fencepost.gnu.org \
--to=aminb@gnu.org \
--cc=david@tethera.net \
/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).