const char *prefix;
} prefix_t;
-prefix_t NORMAL_PREFIX[] = {
- { "subject", "S" },
- { "body", "B" },
- { "from_name", "FN" },
- { "to_name", "TN" },
- { "name", "N" },
- { "attachment", "A" }
-};
-
prefix_t BOOLEAN_PREFIX[] = {
{ "type", "K" },
- { "from_email", "FE" },
- { "to_email", "TE" },
- { "email", "E" },
- { "date", "D" },
- { "label", "L" },
{ "tag", "L" },
- { "source_id", "I" },
- { "attachment_extension", "O" },
{ "msgid", "Q" },
{ "thread", "H" },
{ "ref", "R" },
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE (NORMAL_PREFIX); i++)
- if (strcmp (name, NORMAL_PREFIX[i].name) == 0)
- return NORMAL_PREFIX[i].prefix;
-
for (i = 0; i < ARRAY_SIZE (BOOLEAN_PREFIX); i++)
if (strcmp (name, BOOLEAN_PREFIX[i].name) == 0)
return BOOLEAN_PREFIX[i].prefix;
static char *
timestamp_db_key (const char *key)
{
- if (strlen (key) + 1 > NOTMUCH_TERM_MAX) {
+ int term_len = strlen (_find_prefix ("timestamp")) + strlen (key);
+
+ if (term_len > NOTMUCH_TERM_MAX)
return notmuch_sha1_of_string (key);
- } else {
+ else
return strdup (key);
- }
}
notmuch_status_t