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