mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
notmuch-index-message: Don't index quoted lines and signatures.
At this point, we're achieving a result that is *very* close to what sup does. The only difference is that we are still indexing the "excerpts from message ..." line, and we are not yet indexing references.
This commit is contained in:
parent
9dbb1facfb
commit
048b8aec11
1 changed files with 23 additions and 8 deletions
|
@ -198,7 +198,7 @@ gen_terms_body (Xapian::TermGenerator term_gen,
|
||||||
GIOChannel *channel;
|
GIOChannel *channel;
|
||||||
GIOStatus gio_status;
|
GIOStatus gio_status;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
char *body_str;
|
char *body_line = NULL;
|
||||||
|
|
||||||
channel = g_io_channel_new_file (filename, "r", &error);
|
channel = g_io_channel_new_file (filename, "r", &error);
|
||||||
if (channel == NULL) {
|
if (channel == NULL) {
|
||||||
|
@ -213,16 +213,31 @@ gen_terms_body (Xapian::TermGenerator term_gen,
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
gio_status = g_io_channel_read_to_end (channel, &body_str,
|
while (1) {
|
||||||
NULL, &error);
|
if (body_line)
|
||||||
|
g_free (body_line);
|
||||||
|
|
||||||
|
gio_status = g_io_channel_read_line (channel, &body_line,
|
||||||
|
NULL, NULL, &error);
|
||||||
|
if (gio_status == G_IO_STATUS_EOF)
|
||||||
|
break;
|
||||||
if (gio_status != G_IO_STATUS_NORMAL) {
|
if (gio_status != G_IO_STATUS_NORMAL) {
|
||||||
fprintf (stderr, "Error: %s\n", error->message);
|
fprintf (stderr, "Error: %s\n", error->message);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
gen_terms (term_gen, "body", body_str);
|
if (body_line[0] == '>')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strncmp (body_line, "-- ", 3) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
gen_terms (term_gen, "body", body_line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body_line)
|
||||||
|
g_free (body_line);
|
||||||
|
|
||||||
g_free (body_str);
|
|
||||||
g_io_channel_close (channel);
|
g_io_channel_close (channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue