mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-03-18 21:45:17 +01:00
Split thread_id value on commas before inserting into hash.
One thread_id value may have multiple thread IDs in it so we need to separate them out before inserting into our hash.
This commit is contained in:
parent
27c01802c8
commit
870b398726
1 changed files with 14 additions and 3 deletions
|
@ -269,12 +269,23 @@ static void
|
||||||
insert_thread_id (GHashTable *thread_ids, Xapian::Document doc)
|
insert_thread_id (GHashTable *thread_ids, Xapian::Document doc)
|
||||||
{
|
{
|
||||||
string value_string;
|
string value_string;
|
||||||
const char *value;
|
const char *value, *id, *comma;
|
||||||
|
|
||||||
value_string = doc.get_value (NOTMUCH_VALUE_THREAD);
|
value_string = doc.get_value (NOTMUCH_VALUE_THREAD);
|
||||||
value = value_string.c_str();
|
value = value_string.c_str();
|
||||||
if (strlen (value))
|
if (strlen (value)) {
|
||||||
g_hash_table_insert (thread_ids, strdup (value), NULL);
|
id = value;
|
||||||
|
while (*id) {
|
||||||
|
comma = strchr (id, ',');
|
||||||
|
if (comma == NULL)
|
||||||
|
comma = id + strlen (id);
|
||||||
|
g_hash_table_insert (thread_ids,
|
||||||
|
strndup (id, comma - id), NULL);
|
||||||
|
id = comma;
|
||||||
|
if (*id)
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return one or more thread_ids, (as a GPtrArray of strings), for the
|
/* Return one or more thread_ids, (as a GPtrArray of strings), for the
|
||||||
|
|
Loading…
Add table
Reference in a new issue