NeoMutt  2021-10-29-220-g2b1eec
Teaching an old dog new tricks
DOXYGEN
private.h
Go to the documentation of this file.
1 
23 #include <notmuch.h>
24 #include <stdbool.h>
25 #include <time.h>
26 
27 struct Mailbox;
28 
29 #ifndef MUTT_NOTMUCH_PRIVATE_H
30 #define MUTT_NOTMUCH_PRIVATE_H
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 
59 extern const char NmUrlProtocol[];
60 extern const int NmUrlProtocolLen;
61 
62 notmuch_database_t *nm_db_do_open (const char *filename, bool writable, bool verbose);
63 void nm_db_free (notmuch_database_t *db);
64 const char * nm_db_get_filename(struct Mailbox *m);
65 int nm_db_get_mtime (struct Mailbox *m, time_t *mtime);
66 notmuch_database_t *nm_db_get (struct Mailbox *m, bool writable);
67 bool nm_db_is_longrun (struct Mailbox *m);
68 int nm_db_release (struct Mailbox *m);
69 int nm_db_trans_begin (struct Mailbox *m);
70 int nm_db_trans_end (struct Mailbox *m);
71 
72 #endif /* MUTT_NOTMUCH_PRIVATE_H */
int nm_db_trans_begin(struct Mailbox *m)
Start a Notmuch database transaction.
Definition: db.c:231
const char * nm_db_get_filename(struct Mailbox *m)
Get the filename of the Notmuch database.
Definition: db.c:56
notmuch_database_t * nm_db_get(struct Mailbox *m, bool writable)
Get the Notmuch database.
Definition: db.c:174
int nm_db_get_mtime(struct Mailbox *m, time_t *mtime)
Get the database modification time.
Definition: db.c:280
const int NmUrlProtocolLen
Definition: notmuch.c:94
int nm_db_release(struct Mailbox *m)
Close the Notmuch database.
Definition: db.c:198
bool nm_db_is_longrun(struct Mailbox *m)
Is Notmuch in the middle of a long-running transaction.
Definition: db.c:315
notmuch_database_t * nm_db_do_open(const char *filename, bool writable, bool verbose)
Open a Notmuch database.
Definition: db.c:89
void nm_db_free(notmuch_database_t *db)
Decoupled way to close a Notmuch database.
Definition: db.c:215
const char NmUrlProtocol[]
Definition: notmuch.c:93
int nm_db_trans_end(struct Mailbox *m)
End a database transaction.
Definition: db.c:253
A mailbox.
Definition: mailbox.h:82
struct timespec mtime
Time Mailbox was last changed.
Definition: mailbox.h:107
bool verbose
Display status messages?
Definition: mailbox.h:118