X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fprefix.cc;h=857c05b9b4d49a9659f7cef3c721521f5c92503b;hb=c62c22c9fb222d43d9b9956ce6b6e9985019ea2d;hp=dd7b193d6ff090639a3eebf1d8a20f8396152f31;hpb=3b4097824159c6fdebb8a88b5447beb9a6226ea3;p=notmuch diff --git a/lib/prefix.cc b/lib/prefix.cc index dd7b193d..857c05b9 100644 --- a/lib/prefix.cc +++ b/lib/prefix.cc @@ -46,7 +46,7 @@ prefix_t prefix_table[] = { { "mid", "Q", NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROCESSOR }, { "path", "P", NOTMUCH_FIELD_EXTERNAL | - NOTMUCH_FIELD_PROCESSOR }, + NOTMUCH_FIELD_PROCESSOR | NOTMUCH_FIELD_STRIP_TRAILING_SLASH }, { "property", "XPROPERTY", NOTMUCH_FIELD_EXTERNAL }, /* * Unconditionally add ':' to reduce potential ambiguity with @@ -55,7 +55,7 @@ prefix_t prefix_table[] = { * discussion. */ { "folder", "XFOLDER:", NOTMUCH_FIELD_EXTERNAL | - NOTMUCH_FIELD_PROCESSOR }, + NOTMUCH_FIELD_PROCESSOR | NOTMUCH_FIELD_STRIP_TRAILING_SLASH }, { "date", NULL, NOTMUCH_FIELD_EXTERNAL | NOTMUCH_FIELD_PROCESSOR }, { "query", NULL, NOTMUCH_FIELD_EXTERNAL | @@ -133,8 +133,8 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch) Xapian::FieldProcessor *fp; if (STRNCMP_LITERAL (prefix->name, "date") == 0) - fp = (new DateFieldProcessor(NOTMUCH_VALUE_TIMESTAMP))->release (); - else if (STRNCMP_LITERAL(prefix->name, "query") == 0) + fp = (new DateFieldProcessor (NOTMUCH_VALUE_TIMESTAMP))->release (); + else if (STRNCMP_LITERAL (prefix->name, "query") == 0) fp = (new QueryFieldProcessor (*notmuch->query_parser, notmuch))->release (); else if (STRNCMP_LITERAL (prefix->name, "thread") == 0) fp = (new ThreadFieldProcessor (*notmuch->query_parser, notmuch))->release (); @@ -166,8 +166,7 @@ _notmuch_database_setup_standard_query_fields (notmuch_database_t *notmuch) notmuch_status_t _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) { - notmuch_config_list_t *list; - notmuch_status_t status; + notmuch_string_map_iterator_t *list; notmuch->user_prefix = _notmuch_string_map_create (notmuch); if (notmuch->user_prefix == NULL) @@ -177,15 +176,16 @@ _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) if (notmuch->user_header == NULL) return NOTMUCH_STATUS_OUT_OF_MEMORY; - status = notmuch_database_get_config_list (notmuch, CONFIG_HEADER_PREFIX, &list); - if (status) - return status; + list = _notmuch_string_map_iterator_create (notmuch->config, CONFIG_HEADER_PREFIX, FALSE); + if (! list) + INTERNAL_ERROR ("unable to read headers from configuration"); - for (; notmuch_config_list_valid (list); notmuch_config_list_move_to_next (list)) { + for (; _notmuch_string_map_iterator_valid (list); + _notmuch_string_map_iterator_move_to_next (list)) { prefix_t query_field; - const char *key = notmuch_config_list_key (list) + const char *key = _notmuch_string_map_iterator_key (list) + sizeof (CONFIG_HEADER_PREFIX) - 1; _notmuch_string_map_append (notmuch->user_prefix, @@ -194,7 +194,7 @@ _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) _notmuch_string_map_append (notmuch->user_header, key, - notmuch_config_list_value (list)); + _notmuch_string_map_iterator_value (list)); query_field.name = talloc_strdup (notmuch, key); query_field.prefix = _user_prefix (notmuch, key); @@ -204,7 +204,7 @@ _notmuch_database_setup_user_query_fields (notmuch_database_t *notmuch) _setup_query_field_default (&query_field, notmuch); } - notmuch_config_list_destroy (list); + _notmuch_string_map_iterator_destroy (list); return NOTMUCH_STATUS_SUCCESS; }