mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 03:48:10 +01:00
cli: sanitize the received header before scanning for replies
This makes the from guessing agnostic to header folding by spaces or tabs.
This commit is contained in:
parent
b6238f7e51
commit
31a6333aa4
1 changed files with 10 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "notmuch-client.h"
|
#include "notmuch-client.h"
|
||||||
|
#include "string-util.h"
|
||||||
#include "sprinter.h"
|
#include "sprinter.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -465,14 +466,21 @@ guess_from_in_received_headers (notmuch_config_t *config,
|
||||||
notmuch_message_t *message)
|
notmuch_message_t *message)
|
||||||
{
|
{
|
||||||
const char *received, *addr;
|
const char *received, *addr;
|
||||||
|
char *sanitized;
|
||||||
|
|
||||||
received = notmuch_message_get_header (message, "received");
|
received = notmuch_message_get_header (message, "received");
|
||||||
if (! received)
|
if (! received)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
addr = guess_from_in_received_for (config, received);
|
sanitized = sanitize_string (NULL, received);
|
||||||
|
if (! sanitized)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
addr = guess_from_in_received_for (config, sanitized);
|
||||||
if (! addr)
|
if (! addr)
|
||||||
addr = guess_from_in_received_by (config, received);
|
addr = guess_from_in_received_by (config, sanitized);
|
||||||
|
|
||||||
|
talloc_free (sanitized);
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue