NeoMutt  2022-04-29-178-g3b62e6
Teaching an old dog new tricks
DOXYGEN
private.h
Go to the documentation of this file.
1
23#ifndef MUTT_NOTMUCH_PRIVATE_H
24#define MUTT_NOTMUCH_PRIVATE_H
25
26#include <notmuch.h>
27#include <stdbool.h>
28#include <time.h>
29
30struct Mailbox;
31
32#ifdef LIBNOTMUCH_CHECK_VERSION
33#undef LIBNOTMUCH_CHECK_VERSION
34#endif
35
36#ifndef HAVE_NOTMUCH_DATABASE_INDEX_FILE
37#define HAVE_NOTMUCH_DATABASE_INDEX_FILE 0
38#endif
39
40#ifndef HAVE_NOTMUCH_DATABASE_OPEN_WITH_CONFIG
41#define HAVE_NOTMUCH_DATABASE_OPEN_WITH_CONFIG 0
42#endif
43
44/*
45 * The definition in <notmuch.h> is broken.
46 *
47 * Corrects for libnotmuch releases with missing version bumps:
48 * - libnotmuch 5.4 released with notmuch 0.32. notmuch 0.32.3 fixed version.
49 * - libnotmuch 5.1 released with notmuch 0.26. notmuch 0.26.1 fixed version.
50 */
51#define LIBNOTMUCH_CHECK_VERSION(major, minor, micro) \
52 (major == 5 && minor == 4 && HAVE_NOTMUCH_DATABASE_OPEN_WITH_CONFIG) || \
53 (major == 5 && minor == 1 && HAVE_NOTMUCH_DATABASE_INDEX_FILE) || \
54 ((LIBNOTMUCH_MAJOR_VERSION > (major) || \
55 (LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION > (minor)) || \
56 (LIBNOTMUCH_MAJOR_VERSION == (major) && \
57 LIBNOTMUCH_MINOR_VERSION == (minor) && LIBNOTMUCH_MICRO_VERSION >= (micro))))
58
59extern const char NmUrlProtocol[];
60extern const int NmUrlProtocolLen;
61
62notmuch_database_t *nm_db_do_open (const char *filename, bool writable, bool verbose);
63void nm_db_free (notmuch_database_t *db);
64const char * nm_db_get_filename(struct Mailbox *m);
65int nm_db_get_mtime (struct Mailbox *m, time_t *mtime);
66notmuch_database_t *nm_db_get (struct Mailbox *m, bool writable);
67bool nm_db_is_longrun (struct Mailbox *m);
68int nm_db_release (struct Mailbox *m);
69int nm_db_trans_begin (struct Mailbox *m);
70int nm_db_trans_end (struct Mailbox *m);
71
72#endif /* MUTT_NOTMUCH_PRIVATE_H */
notmuch_database_t * nm_db_get(struct Mailbox *m, bool writable)
Get the Notmuch database.
Definition: db.c:169
int nm_db_trans_begin(struct Mailbox *m)
Start a Notmuch database transaction.
Definition: db.c:226
notmuch_database_t * nm_db_do_open(const char *filename, bool writable, bool verbose)
Open a Notmuch database.
Definition: db.c:86
const char * nm_db_get_filename(struct Mailbox *m)
Get the filename of the Notmuch database.
Definition: db.c:54
int nm_db_get_mtime(struct Mailbox *m, time_t *mtime)
Get the database modification time.
Definition: db.c:275
const int NmUrlProtocolLen
Definition: notmuch.c:94
int nm_db_release(struct Mailbox *m)
Close the Notmuch database.
Definition: db.c:193
bool nm_db_is_longrun(struct Mailbox *m)
Is Notmuch in the middle of a long-running transaction.
Definition: db.c:310
void nm_db_free(notmuch_database_t *db)
Decoupled way to close a Notmuch database.
Definition: db.c:210
const char NmUrlProtocol[]
Definition: notmuch.c:93
int nm_db_trans_end(struct Mailbox *m)
End a database transaction.
Definition: db.c:248
A mailbox.
Definition: mailbox.h:79
struct timespec mtime
Time Mailbox was last changed.
Definition: mailbox.h:104
bool verbose
Display status messages?
Definition: mailbox.h:115