mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
Use gmime's own reference-parsing code.
Here's another instance where I "knew" gmime must have support for some functionality, but not finding it, I rolled my own. Now that I found g_mime_references_decode I'm glad to drop my ugly code.
This commit is contained in:
parent
1c63ec7031
commit
be72bf3070
1 changed files with 11 additions and 19 deletions
|
@ -307,30 +307,22 @@ find_thread_id (Xapian::Database db,
|
||||||
* message. */
|
* message. */
|
||||||
static void
|
static void
|
||||||
parse_references (GPtrArray *array,
|
parse_references (GPtrArray *array,
|
||||||
const char *refs)
|
const char *refs_str)
|
||||||
{
|
{
|
||||||
const char *end, *next;
|
GMimeReferences *refs, *r;
|
||||||
|
const char *message_id;
|
||||||
|
|
||||||
if (refs == NULL)
|
if (refs_str == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (*refs) {
|
refs = g_mime_references_decode (refs_str);
|
||||||
while (*refs && isspace (*refs))
|
|
||||||
refs++;
|
for (r = refs; r; r = r->next) {
|
||||||
if (*refs == '<')
|
message_id = g_mime_references_get_message_id (r);
|
||||||
refs++;
|
g_ptr_array_add (array, g_strdup (message_id));
|
||||||
end = refs;
|
|
||||||
while (*end && !isspace (*end))
|
|
||||||
end++;
|
|
||||||
next = end;
|
|
||||||
end--;
|
|
||||||
if (end > refs && *end == '>')
|
|
||||||
end--;
|
|
||||||
if (end > refs) {
|
|
||||||
g_ptr_array_add (array, g_strndup (refs, end - refs + 1));
|
|
||||||
}
|
|
||||||
refs = next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_mime_references_free (refs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a string representing the body of a message, generate terms
|
/* Given a string representing the body of a message, generate terms
|
||||||
|
|
Loading…
Reference in a new issue