mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-01 07:04:10 +01:00
b31e44c678
The idea is that if a message-id parses with this function, the MUA generating it was probably sane, and in particular it's probably safe to use the result as a parent from In-Reply-to.
26 lines
539 B
C
26 lines
539 B
C
#include <stdio.h>
|
|
#include <talloc.h>
|
|
#include "notmuch-private.h"
|
|
|
|
int
|
|
main (unused (int argc), unused (char **argv))
|
|
{
|
|
char *line = NULL;
|
|
size_t len = 0;
|
|
ssize_t nread;
|
|
void *local = talloc_new (NULL);
|
|
|
|
while ((nread = getline (&line, &len, stdin)) != -1) {
|
|
int last = strlen (line) - 1;
|
|
if (line[last] == '\n')
|
|
line[last] = '\0';
|
|
|
|
char *mid = _notmuch_message_id_parse_strict (local, line);
|
|
if (mid)
|
|
printf ("GOOD: %s\n", mid);
|
|
else
|
|
printf ("BAD: %s\n", line);
|
|
}
|
|
|
|
talloc_free (local);
|
|
}
|