import cffi
-
+from _notmuch_config import *
ffibuilder = cffi.FFI()
ffibuilder.set_source(
#if LIBNOTMUCH_MAJOR_VERSION < 5
#error libnotmuch version not supported by notmuch2 python bindings
#endif
+ #if LIBNOTMUCH_MINOR_VERSION < 1
+ #ERROR libnotmuch version < 5.1 not supported
+ #endif
""",
- include_dirs=['../../lib'],
- library_dirs=['../../lib'],
+ include_dirs=[NOTMUCH_INCLUDE_DIR],
+ library_dirs=[NOTMUCH_LIB_DIR],
libraries=['notmuch'],
)
ffibuilder.cdef(
NOTMUCH_STATUS_UPGRADE_REQUIRED,
NOTMUCH_STATUS_PATH_ERROR,
NOTMUCH_STATUS_ILLEGAL_ARGUMENT,
+ NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL,
+ NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION,
+ NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL,
+ NOTMUCH_STATUS_NO_CONFIG,
+ NOTMUCH_STATUS_NO_DATABASE,
+ NOTMUCH_STATUS_DATABASE_EXISTS,
+ NOTMUCH_STATUS_BAD_QUERY_SYNTAX,
+ NOTMUCH_STATUS_NO_MAIL_ROOT,
NOTMUCH_STATUS_LAST_STATUS
} notmuch_status_t;
typedef enum {
NOTMUCH_EXCLUDE_FALSE,
NOTMUCH_EXCLUDE_ALL
} notmuch_exclude_t;
+ typedef enum {
+ NOTMUCH_DECRYPT_FALSE,
+ NOTMUCH_DECRYPT_TRUE,
+ NOTMUCH_DECRYPT_AUTO,
+ NOTMUCH_DECRYPT_NOSTASH,
+ } notmuch_decryption_policy_t;
// These are fully opaque types for us, we only ever use pointers.
typedef struct _notmuch_database notmuch_database_t;
typedef struct _notmuch_string_map_iterator notmuch_message_properties_t;
typedef struct _notmuch_directory notmuch_directory_t;
typedef struct _notmuch_filenames notmuch_filenames_t;
- typedef struct _notmuch_config_list notmuch_config_list_t;
+ typedef struct _notmuch_config_pairs notmuch_config_pairs_t;
+ typedef struct _notmuch_indexopts notmuch_indexopts_t;
const char *
notmuch_status_to_string (notmuch_status_t status);
notmuch_status_t
- notmuch_database_create_verbose (const char *path,
- notmuch_database_t **database,
- char **error_message);
- notmuch_status_t
- notmuch_database_create (const char *path, notmuch_database_t **database);
+ notmuch_database_create_with_config (const char *database_path,
+ const char *config_path,
+ const char *profile,
+ notmuch_database_t **database,
+ char **error_message);
notmuch_status_t
- notmuch_database_open_verbose (const char *path,
- notmuch_database_mode_t mode,
- notmuch_database_t **database,
- char **error_message);
- notmuch_status_t
- notmuch_database_open (const char *path,
- notmuch_database_mode_t mode,
- notmuch_database_t **database);
+ notmuch_database_open_with_config (const char *database_path,
+ notmuch_database_mode_t mode,
+ const char *config_path,
+ const char *profile,
+ notmuch_database_t **database,
+ char **error_message);
notmuch_status_t
notmuch_database_close (notmuch_database_t *database);
notmuch_status_t
notmuch_database_get_revision (notmuch_database_t *notmuch,
const char **uuid);
notmuch_status_t
- notmuch_database_add_message (notmuch_database_t *database,
- const char *filename,
- notmuch_message_t **message);
+ notmuch_database_index_file (notmuch_database_t *database,
+ const char *filename,
+ notmuch_indexopts_t *indexopts,
+ notmuch_message_t **message);
notmuch_status_t
notmuch_database_remove_message (notmuch_database_t *database,
const char *filename);
notmuch_filenames_move_to_next (notmuch_filenames_t *filenames);
void
notmuch_filenames_destroy (notmuch_filenames_t *filenames);
+ notmuch_indexopts_t *
+ notmuch_database_get_default_indexopts (notmuch_database_t *db);
+ notmuch_status_t
+ notmuch_indexopts_set_decrypt_policy (notmuch_indexopts_t *indexopts,
+ notmuch_decryption_policy_t decrypt_policy);
+ notmuch_decryption_policy_t
+ notmuch_indexopts_get_decrypt_policy (const notmuch_indexopts_t *indexopts);
+ void
+ notmuch_indexopts_destroy (notmuch_indexopts_t *options);
+
+ notmuch_status_t
+ notmuch_database_set_config (notmuch_database_t *db, const char *key, const char *value);
+ notmuch_status_t
+ notmuch_database_get_config (notmuch_database_t *db, const char *key, char **value);
+ notmuch_config_pairs_t *
+ notmuch_config_get_pairs (notmuch_database_t *db, const char *prefix);
+ notmuch_bool_t
+ notmuch_config_pairs_valid (notmuch_config_pairs_t *config_list);
+ const char *
+ notmuch_config_pairs_key (notmuch_config_pairs_t *config_list);
+ const char *
+ notmuch_config_pairs_value (notmuch_config_pairs_t *config_list);
+ void
+ notmuch_config_pairs_move_to_next (notmuch_config_pairs_t *config_list);
+ void
+ notmuch_config_pairs_destroy (notmuch_config_pairs_t *config_list);
"""
)