NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mxapi.h
Go to the documentation of this file.
1
24#ifndef MUTT_CORE_MXAPI_H
25#define MUTT_CORE_MXAPI_H
26
27#include "config.h"
28#include <stdbool.h>
29#include <stdint.h>
30#include "mailbox.h"
31
32struct Account;
33struct Buffer;
34struct Email;
35struct Message;
36struct stat;
37
38/* flags for mutt_open_mailbox() */
39typedef uint8_t OpenMailboxFlags;
40#define MUTT_OPEN_NO_FLAGS 0
41#define MUTT_NOSORT (1 << 0)
42#define MUTT_APPEND (1 << 1)
43#define MUTT_READONLY (1 << 2)
44#define MUTT_QUIET (1 << 3)
45#define MUTT_NEWFOLDER (1 << 4)
48#define MUTT_PEEK (1 << 5)
49#define MUTT_APPENDNEW (1 << 6)
51
52typedef uint8_t CheckStatsFlags;
53#define MUTT_MAILBOX_CHECK_NO_FLAGS 0
54#define MUTT_MAILBOX_CHECK_POSTPONED (1 << 0)
55#define MUTT_MAILBOX_CHECK_STATS (1 << 1)
56#define MUTT_MAILBOX_CHECK_IMMEDIATE (1 << 2)
57
63{
70};
71
76{
80};
81
90struct MxOps
91{
93 const char *name;
94 bool is_local;
95
109 bool (*ac_owns_path)(struct Account *a, const char *path);
110
124 bool (*ac_add)(struct Account *a, struct Mailbox *m);
125
136 enum MxOpenReturns (*mbox_open)(struct Mailbox *m);
137
150 bool (*mbox_open_append)(struct Mailbox *m, OpenMailboxFlags flags);
151
162 enum MxStatus (*mbox_check)(struct Mailbox *m);
163
175 enum MxStatus (*mbox_check_stats)(struct Mailbox *m, CheckStatsFlags flags);
176
187 enum MxStatus (*mbox_sync)(struct Mailbox *m);
188
199 enum MxStatus (*mbox_close)(struct Mailbox *m);
200
216 bool (*msg_open)(struct Mailbox *m, struct Message *msg, struct Email *e);
217
232 bool (*msg_open_new)(struct Mailbox *m, struct Message *msg, const struct Email *e);
233
247 int (*msg_commit)(struct Mailbox *m, struct Message *msg);
248
262 int (*msg_close)(struct Mailbox *m, struct Message *msg);
263
274 int (*msg_padding_size)(struct Mailbox *m);
275
289 int (*msg_save_hcache)(struct Mailbox *m, struct Email *e);
290
306 int (*tags_edit)(struct Mailbox *m, const char *tags, struct Buffer *buf);
307
323 int (*tags_commit)(struct Mailbox *m, struct Email *e, const char *buf);
324
336 enum MailboxType (*path_probe)(const char *path, const struct stat *st);
337
349 int (*path_canon)(struct Buffer *path);
350
363 int (*path_is_empty)(struct Buffer *path);
364};
365
366#endif /* MUTT_CORE_MXAPI_H */
MailboxType
Supported mailbox formats.
Definition: mailbox.h:41
Maildir Mailbox.
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
Definition: mxapi.h:39
MxOpenReturns
Return values for mbox_open()
Definition: mxapi.h:76
@ MX_OPEN_ERROR
Open failed with an error.
Definition: mxapi.h:78
@ MX_OPEN_ABORT
Open was aborted.
Definition: mxapi.h:79
@ MX_OPEN_OK
Open succeeded.
Definition: mxapi.h:77
uint8_t CheckStatsFlags
Flags for mutt_mailbox_check.
Definition: mxapi.h:52
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_sync(), and mbox_close()
Definition: mxapi.h:63
@ MX_STATUS_LOCKED
Couldn't lock the Mailbox.
Definition: mxapi.h:67
@ MX_STATUS_ERROR
An error occurred.
Definition: mxapi.h:64
@ MX_STATUS_OK
No changes.
Definition: mxapi.h:65
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
Definition: mxapi.h:69
@ MX_STATUS_REOPENED
Mailbox was reopened.
Definition: mxapi.h:68
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Definition: mxapi.h:66
A group of associated Mailboxes.
Definition: account.h:36
String manipulation buffer.
Definition: buffer.h:36
The envelope/body of an email.
Definition: email.h:39
A mailbox.
Definition: mailbox.h:79
A local copy of an email.
Definition: message.h:34
Definition: mxapi.h:91
int(* path_is_empty)(struct Buffer *path)
Definition: mxapi.h:363
bool is_local
True, if Mailbox type has local files/dirs.
Definition: mxapi.h:94
bool(* msg_open)(struct Mailbox *m, struct Message *msg, struct Email *e)
Definition: mxapi.h:216
int(* tags_commit)(struct Mailbox *m, struct Email *e, const char *buf)
Definition: mxapi.h:323
int(* msg_save_hcache)(struct Mailbox *m, struct Email *e)
Definition: mxapi.h:289
enum MailboxType(* path_probe)(const char *path, const struct stat *st)
Definition: mxapi.h:336
enum MailboxType type
Mailbox type, e.g. MUTT_IMAP.
Definition: mxapi.h:92
int(* msg_padding_size)(struct Mailbox *m)
Definition: mxapi.h:274
bool(* ac_owns_path)(struct Account *a, const char *path)
Definition: mxapi.h:109
int(* tags_edit)(struct Mailbox *m, const char *tags, struct Buffer *buf)
Definition: mxapi.h:306
int(* msg_commit)(struct Mailbox *m, struct Message *msg)
Definition: mxapi.h:247
enum MxStatus(* mbox_check_stats)(struct Mailbox *m, CheckStatsFlags flags)
Definition: mxapi.h:175
bool(* ac_add)(struct Account *a, struct Mailbox *m)
Definition: mxapi.h:124
enum MxOpenReturns(* mbox_open)(struct Mailbox *m)
Definition: mxapi.h:136
int(* msg_close)(struct Mailbox *m, struct Message *msg)
Definition: mxapi.h:262
bool(* msg_open_new)(struct Mailbox *m, struct Message *msg, const struct Email *e)
Definition: mxapi.h:232
const char * name
Mailbox name, e.g. "imap".
Definition: mxapi.h:93
int(* path_canon)(struct Buffer *path)
Definition: mxapi.h:349
enum MxStatus(* mbox_close)(struct Mailbox *m)
Definition: mxapi.h:199
enum MxStatus(* mbox_sync)(struct Mailbox *m)
Definition: mxapi.h:187
bool(* mbox_open_append)(struct Mailbox *m, OpenMailboxFlags flags)
Definition: mxapi.h:150
enum MxStatus(* mbox_check)(struct Mailbox *m)
Definition: mxapi.h:162