mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
fix notmuch_message_file_get_header
fix notmuch_message_file_get_header to always return the first instance of the header you are looking for Signed-off-by: Dirk Hohndel <hohndel@infradead.org>
This commit is contained in:
parent
7d9851e293
commit
a48f368778
1 changed files with 9 additions and 3 deletions
|
@ -318,9 +318,15 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
|
|||
match = (strcasecmp (header, header_desired) == 0);
|
||||
|
||||
decoded_value = g_mime_utils_header_decode_text (message->value.str);
|
||||
|
||||
if (g_hash_table_lookup (message->headers, header) == NULL) {
|
||||
/* Only insert if we don't have a value for this header, yet.
|
||||
* This way we always return the FIRST instance of any header
|
||||
* we search for
|
||||
* FIXME: we should be returning ALL instances of a header
|
||||
* or at least provide a way to iterate over them
|
||||
*/
|
||||
g_hash_table_insert (message->headers, header, decoded_value);
|
||||
|
||||
}
|
||||
if (match)
|
||||
return decoded_value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue