NeoMutt  2020-08-21-74-g346364
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 #include "core/lib.h"
27 #include "progress.h"
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 /* The definition in <notmuch.h> is broken */
37 #define LIBNOTMUCH_CHECK_VERSION(major, minor, micro) \
38  (LIBNOTMUCH_MAJOR_VERSION > (major) || \
39  (LIBNOTMUCH_MAJOR_VERSION == (major) && LIBNOTMUCH_MINOR_VERSION > (minor)) || \
40  (LIBNOTMUCH_MAJOR_VERSION == (major) && \
41  LIBNOTMUCH_MINOR_VERSION == (minor) && LIBNOTMUCH_MICRO_VERSION >= (micro)))
42 
43 extern const int NmUrlProtocolLen;
44 
49 {
50  notmuch_database_t *db;
51  bool longrun : 1;
52  bool trans : 1;
53 };
54 
61 {
64 };
65 
69 struct NmMboxData
70 {
71  struct Url *db_url;
72  char *db_query;
73  int db_limit;
74  enum NmQueryType query_type;
75 
76  struct Progress progress;
79 
80  bool noprogress : 1;
81  bool progress_ready : 1;
82 };
83 
88 {
89  char *folder;
90  char *oldpath;
91  char *virtual_id;
93 };
94 
95 extern int C_NmDbLimit;
96 extern char *C_NmDefaultUrl;
97 extern char *C_NmExcludeTags;
98 extern char *C_NmFlaggedTag;
99 extern int C_NmOpenTimeout;
100 extern char *C_NmQueryType;
102 extern char *C_NmQueryWindowTimebase;
103 extern char *C_NmRecordTags;
104 extern char *C_NmRepliedTag;
105 extern char *C_NmUnreadTag;
106 
107 notmuch_database_t *nm_db_do_open (const char *filename, bool writable, bool verbose);
108 void nm_db_free (notmuch_database_t *db);
109 const char * nm_db_get_filename(struct Mailbox *m);
110 int nm_db_get_mtime (struct Mailbox *m, time_t *mtime);
111 notmuch_database_t *nm_db_get (struct Mailbox *m, bool writable);
112 bool nm_db_is_longrun (struct Mailbox *m);
113 int nm_db_release (struct Mailbox *m);
114 int nm_db_trans_begin (struct Mailbox *m);
115 int nm_db_trans_end (struct Mailbox *m);
116 
117 void nm_adata_free(void **ptr);
118 struct NmAccountData *nm_adata_get (struct Mailbox *m);
119 struct NmAccountData *nm_adata_new (void);
120 void nm_edata_free(void **ptr);
121 struct NmEmailData * nm_edata_get (struct Email *e);
122 struct NmEmailData * nm_edata_new (void);
123 void nm_mdata_free(void **ptr);
124 struct NmMboxData * nm_mdata_get (struct Mailbox *m);
125 struct NmMboxData * nm_mdata_new (const char *url);
126 
127 #endif /* MUTT_NOTMUCH_PRIVATE_H */
int nm_db_get_mtime(struct Mailbox *m, time_t *mtime)
Get the database modification time.
Definition: db.c:253
notmuch_database_t * nm_db_do_open(const char *filename, bool writable, bool verbose)
Open a Notmuch database.
Definition: db.c:83
int nm_db_trans_begin(struct Mailbox *m)
Start a Notmuch database transaction.
Definition: db.c:204
notmuch_database_t * nm_db_get(struct Mailbox *m, bool writable)
Get the Notmuch database.
Definition: db.c:147
void nm_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free()
Definition: notmuch.c:120
The envelope/body of an email.
Definition: email.h:37
const int NmUrlProtocolLen
Definition: notmuch.c:74
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:66
char * oldpath
Definition: private.h:90
char * C_NmRepliedTag
Config: (notmuch) Tag to use for replied messages.
Definition: config.c:48
NmQueryType
Notmuch Query Types.
Definition: private.h:60
bool longrun
A long-lived action is in progress.
Definition: private.h:51
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
int C_NmOpenTimeout
Config: (notmuch) Database timeout.
Definition: config.c:41
A progress bar.
Definition: progress.h:50
int nm_db_trans_end(struct Mailbox *m)
End a database transaction.
Definition: db.c:226
int oldmsgcount
Definition: private.h:77
notmuch_database_t * db
Definition: private.h:50
char * C_NmUnreadTag
Config: (notmuch) Tag to use for unread messages.
Definition: config.c:49
Notmuch-specific Mailbox data -.
Definition: private.h:69
char * virtual_id
Unique Notmuch Id.
Definition: private.h:91
char * folder
Location of the Email.
Definition: private.h:89
Convenience wrapper for the core headers.
bool nm_db_is_longrun(struct Mailbox *m)
Is Notmuch in the middle of a long-running transaction.
Definition: db.c:275
Progress bar.
struct NmEmailData * nm_edata_get(struct Email *e)
Get the Notmuch Email data.
Definition: notmuch.c:264
char * C_NmRecordTags
Config: (notmuch) Tags to apply to the &#39;record&#39; mailbox (sent mail)
Definition: config.c:47
struct NmAccountData * nm_adata_get(struct Mailbox *m)
Get the Notmuch Account data.
Definition: notmuch.c:152
A mailbox.
Definition: mailbox.h:81
Notmuch-specific Email data -.
Definition: private.h:87
const char * nm_db_get_filename(struct Mailbox *m)
Get the filename of the Notmuch database.
Definition: db.c:53
char * C_NmExcludeTags
Config: (notmuch) Exclude messages with these tags.
Definition: config.c:39
struct NmAccountData * nm_adata_new(void)
Allocate and initialise a new NmAccountData structure.
Definition: notmuch.c:139
char * db_query
Previous query.
Definition: private.h:72
Default: Messages only.
Definition: private.h:62
char * C_NmDefaultUrl
Config: (notmuch) Path to the Notmuch database.
Definition: config.c:38
void nm_db_free(notmuch_database_t *db)
decoupled way to close a Notmuch database
Definition: db.c:188
int C_NmDbLimit
Config: (notmuch) Default limit for Notmuch queries.
Definition: config.c:37
bool trans
Atomic transaction in progress.
Definition: private.h:52
int C_NmQueryWindowCurrentPosition
Config: (notmuch) Position of current search window.
Definition: config.c:43
char * C_NmQueryType
Config: (notmuch) Default query type: &#39;threads&#39; or &#39;messages&#39;.
Definition: config.c:42
struct Url * db_url
Parsed view url of the Notmuch database.
Definition: private.h:71
char * C_NmFlaggedTag
Config: (notmuch) Tag to use for flagged messages.
Definition: config.c:40
struct NmEmailData * nm_edata_new(void)
Create a new NmEmailData for an email.
Definition: notmuch.c:253
MailboxType
Supported mailbox formats.
Definition: mailbox.h:43
int ignmsgcount
Ignored messages.
Definition: private.h:78
struct NmMboxData * nm_mdata_get(struct Mailbox *m)
Get the Notmuch Mailbox data.
Definition: notmuch.c:219
Whole threads.
Definition: private.h:63
int nm_db_release(struct Mailbox *m)
Close the Notmuch database.
Definition: db.c:171
bool noprogress
Don&#39;t show the progress bar.
Definition: private.h:80
void nm_edata_free(void **ptr)
Free data attached to an Email.
Definition: notmuch.c:234
bool progress_ready
A progress bar has been initialised.
Definition: private.h:81
int db_limit
Maximum number of results to return.
Definition: private.h:73
void nm_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free()
Definition: notmuch.c:171
char * C_NmQueryWindowTimebase
Config: (notmuch) Units for the time duration.
Definition: config.c:46
struct NmMboxData * nm_mdata_new(const char *url)
Create a new NmMboxData object from a query.
Definition: notmuch.c:193
Notmuch-specific Account data -.
Definition: private.h:48