X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fnotmuch-private.h;h=ac315e4c99b77ae316571d3b0d686612100f05c3;hp=f52b4e4776f956d1854c594574657d84a1d0094a;hb=30c475c1ef3d6823ed9ab0affc30328726c5240f;hpb=7f57b747b95eece465d10fd0acba20cc3dd868f1 diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h index f52b4e47..ac315e4c 100644 --- a/lib/notmuch-private.h +++ b/lib/notmuch-private.h @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ . + * along with this program. If not, see https://www.gnu.org/licenses/ . * * Author: Carl Worth */ @@ -50,8 +50,7 @@ NOTMUCH_BEGIN_DECLS #include "xutil.h" #include "error_util.h" - -#pragma GCC visibility push(hidden) +#include "string-util.h" #ifdef DEBUG # define DEBUG_DATABASE_SANITY 1 @@ -75,12 +74,6 @@ NOTMUCH_BEGIN_DECLS #define unused(x) x __attribute__ ((unused)) -#ifdef __cplusplus -# define visible __attribute__((visibility("default"))) -#else -# define visible -#endif - /* Thanks to Andrew Tridgell's (SAMBA's) talloc for this definition of * unlikely. The talloc source code comes to us via the GNU LGPL v. 3. */ @@ -157,8 +150,8 @@ typedef enum _notmuch_private_status { ((private_status >= (notmuch_private_status_t) NOTMUCH_STATUS_LAST_STATUS)\ ? \ _internal_error (format " (%s).\n", \ - ##__VA_ARGS__, \ - __location__), \ + ##__VA_ARGS__, \ + __location__), \ (notmuch_status_t) NOTMUCH_PRIVATE_STATUS_SUCCESS \ : \ (notmuch_status_t) private_status) @@ -191,10 +184,17 @@ _notmuch_message_id_compressed (void *ctx, const char *message_id); notmuch_status_t _notmuch_database_ensure_writable (notmuch_database_t *notmuch); +notmuch_status_t +_notmuch_database_reopen (notmuch_database_t *notmuch); + void _notmuch_database_log (notmuch_database_t *notmuch, const char *format, ...); +void +_notmuch_database_log_append (notmuch_database_t *notmuch, + const char *format, ...); + unsigned long _notmuch_database_new_revision (notmuch_database_t *notmuch); @@ -278,6 +278,12 @@ _notmuch_message_remove_term (notmuch_message_t *message, const char *prefix_name, const char *value); +notmuch_private_status_t +_notmuch_message_has_term (notmuch_message_t *message, + const char *prefix_name, + const char *value, + notmuch_bool_t *result); + notmuch_private_status_t _notmuch_message_gen_terms (notmuch_message_t *message, const char *prefix_name, @@ -441,7 +447,7 @@ typedef struct _notmuch_message_list { * somewhere with some nasty C++ objects in it. We'll try to maintain * ignorance of that here. (See notmuch_mset_messages_t in query.cc) */ -struct visible _notmuch_messages { +struct _notmuch_messages { notmuch_bool_t is_of_list_type; notmuch_doc_id_set_t *excluded_doc_ids; notmuch_message_node_t *iterator; @@ -470,11 +476,22 @@ _notmuch_mset_messages_move_to_next (notmuch_messages_t *messages); notmuch_bool_t _notmuch_doc_id_set_contains (notmuch_doc_id_set_t *doc_ids, - unsigned int doc_id); + unsigned int doc_id); void _notmuch_doc_id_set_remove (notmuch_doc_id_set_t *doc_ids, - unsigned int doc_id); + unsigned int doc_id); + +/* querying xapian documents by type (e.g. "mail" or "ghost"): */ +notmuch_status_t +_notmuch_query_search_documents (notmuch_query_t *query, + const char *type, + notmuch_messages_t **out); + +notmuch_status_t +_notmuch_query_count_documents (notmuch_query_t *query, + const char *type, + unsigned *count_out); /* message.cc */ @@ -499,7 +516,7 @@ typedef struct _notmuch_string_node { struct _notmuch_string_node *next; } notmuch_string_node_t; -typedef struct visible _notmuch_string_list { +typedef struct _notmuch_string_list { int length; notmuch_string_node_t *head; notmuch_string_node_t **tail; @@ -519,6 +536,39 @@ _notmuch_string_list_append (notmuch_string_list_t *list, void _notmuch_string_list_sort (notmuch_string_list_t *list); +/* string-map.c */ +typedef struct _notmuch_string_map notmuch_string_map_t; +typedef struct _notmuch_string_map_iterator notmuch_string_map_iterator_t; +notmuch_string_map_t * +_notmuch_string_map_create (const void *ctx); + +void +_notmuch_string_map_append (notmuch_string_map_t *map, + const char *key, + const char *value); + +const char * +_notmuch_string_map_get (notmuch_string_map_t *map, const char *key); + +notmuch_string_map_iterator_t * +_notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key, + notmuch_bool_t exact); + +notmuch_bool_t +_notmuch_string_map_iterator_valid (notmuch_string_map_iterator_t *iter); + +void +_notmuch_string_map_iterator_move_to_next (notmuch_string_map_iterator_t *iter); + +const char * +_notmuch_string_map_iterator_key (notmuch_string_map_iterator_t *iterator); + +const char * +_notmuch_string_map_iterator_value (notmuch_string_map_iterator_t *iterator); + +void +_notmuch_string_map_iterator_destroy (notmuch_string_map_iterator_t *iterator); + /* tags.c */ notmuch_tags_t * @@ -563,6 +613,4 @@ _notmuch_talloc_steal (const void *new_ctx, const T *ptr) #endif #endif -#pragma GCC visibility pop - #endif