NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
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 <stdio.h>
31#include <sys/types.h>
32#include "mailbox.h"
33
34struct Account;
35struct Buffer;
36struct Email;
37struct stat;
38
42struct Message
43{
44 FILE *fp;
45 char *path;
47 bool write;
48 struct
49 {
50 bool read : 1;
51 bool flagged : 1;
52 bool replied : 1;
53 bool draft : 1;
55 time_t received;
56};
57
58
59/* flags for mutt_open_mailbox() */
60typedef uint8_t OpenMailboxFlags;
61#define MUTT_OPEN_NO_FLAGS 0
62#define MUTT_NOSORT (1 << 0)
63#define MUTT_APPEND (1 << 1)
64#define MUTT_READONLY (1 << 2)
65#define MUTT_QUIET (1 << 3)
66#define MUTT_NEWFOLDER (1 << 4)
69#define MUTT_PEEK (1 << 5)
70#define MUTT_APPENDNEW (1 << 6)
72
73typedef uint8_t CheckStatsFlags;
74#define MUTT_MAILBOX_CHECK_NO_FLAGS 0
75#define MUTT_MAILBOX_CHECK_FORCE (1 << 0)
76#define MUTT_MAILBOX_CHECK_FORCE_STATS (1 << 1)
77#define MUTT_MAILBOX_CHECK_IMMEDIATE (1 << 2)
78
84{
91};
92
97{
101};
102
111struct MxOps
112{
114 const char *name;
115 bool is_local;
116
131 bool (*ac_owns_path)(struct Account *a, const char *path);
132
147 bool (*ac_add)(struct Account *a, struct Mailbox *m);
148
160 enum MxOpenReturns (*mbox_open)(struct Mailbox *m);
161
175 bool (*mbox_open_append)(struct Mailbox *m, OpenMailboxFlags flags);
176
188 enum MxStatus (*mbox_check)(struct Mailbox *m);
189
202 enum MxStatus (*mbox_check_stats)(struct Mailbox *m, CheckStatsFlags flags);
203
215 enum MxStatus (*mbox_sync)(struct Mailbox *m);
216
228 enum MxStatus (*mbox_close)(struct Mailbox *m);
229
246 bool (*msg_open)(struct Mailbox *m, struct Message *msg, int msgno);
247
263 bool (*msg_open_new)(struct Mailbox *m, struct Message *msg, const struct Email *e);
264
279 int (*msg_commit) (struct Mailbox *m, struct Message *msg);
280
295 int (*msg_close) (struct Mailbox *m, struct Message *msg);
296
308 int (*msg_padding_size)(struct Mailbox *m);
309
324 int (*msg_save_hcache) (struct Mailbox *m, struct Email *e);
325
342 int (*tags_edit) (struct Mailbox *m, const char *tags, struct Buffer *buf);
343
360 int (*tags_commit) (struct Mailbox *m, struct Email *e, const char *buf);
361
374 enum MailboxType (*path_probe)(const char *path, const struct stat *st);
375
389 int (*path_canon) (char *buf, size_t buflen);
390
405 int (*path_pretty) (char *buf, size_t buflen, const char *folder);
406
420 int (*path_parent) (char *buf, size_t buflen);
421
435 int (*path_is_empty) (const char *path);
436};
437
438#endif /* MUTT_CORE_MXAPI_H */
Representation of a mailbox.
MailboxType
Supported mailbox formats.
Definition: mailbox.h:41
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
Definition: mxapi.h:60
MxOpenReturns
Return values for mbox_open()
Definition: mxapi.h:97
@ MX_OPEN_ERROR
Open failed with an error.
Definition: mxapi.h:99
@ MX_OPEN_ABORT
Open was aborted.
Definition: mxapi.h:100
@ MX_OPEN_OK
Open succeeded.
Definition: mxapi.h:98
uint8_t CheckStatsFlags
Flags for mutt_mailbox_check.
Definition: mxapi.h:73
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close()
Definition: mxapi.h:84
@ MX_STATUS_LOCKED
Couldn't lock the Mailbox.
Definition: mxapi.h:88
@ MX_STATUS_ERROR
An error occurred.
Definition: mxapi.h:85
@ MX_STATUS_OK
No changes.
Definition: mxapi.h:86
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
Definition: mxapi.h:90
@ MX_STATUS_REOPENED
Mailbox was reopened.
Definition: mxapi.h:89
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Definition: mxapi.h:87
A group of associated Mailboxes.
Definition: account.h:37
String manipulation buffer.
Definition: buffer.h:34
The envelope/body of an email.
Definition: email.h:37
char * path
Path of Email (for local Mailboxes)
Definition: email.h:68
A mailbox.
Definition: mailbox.h:79
A local copy of an email.
Definition: mxapi.h:43
FILE * fp
pointer to the message data
Definition: mxapi.h:44
char * path
path to temp file
Definition: mxapi.h:45
bool draft
Message has been read.
Definition: mxapi.h:53
bool replied
Message has been replied to.
Definition: mxapi.h:52
char * committed_path
the final path generated by mx_msg_commit()
Definition: mxapi.h:46
time_t received
Time at which this message was received.
Definition: mxapi.h:55
bool write
nonzero if message is open for writing
Definition: mxapi.h:47
bool flagged
Message is flagged.
Definition: mxapi.h:51
bool read
Message has been read.
Definition: mxapi.h:50
struct Message::@0 flags
Flags for the Message.
Definition: mxapi.h:112
int(* path_parent)(char *buf, size_t buflen)
Definition: mxapi.h:420
bool is_local
True, if Mailbox type has local files/dirs.
Definition: mxapi.h:115
int(* tags_commit)(struct Mailbox *m, struct Email *e, const char *buf)
Definition: mxapi.h:360
int(* path_pretty)(char *buf, size_t buflen, const char *folder)
Definition: mxapi.h:405
int(* msg_save_hcache)(struct Mailbox *m, struct Email *e)
Definition: mxapi.h:324
enum MailboxType(* path_probe)(const char *path, const struct stat *st)
Definition: mxapi.h:374
int(* path_is_empty)(const char *path)
Definition: mxapi.h:435
enum MailboxType type
Mailbox type, e.g. MUTT_IMAP.
Definition: mxapi.h:113
int(* msg_padding_size)(struct Mailbox *m)
Definition: mxapi.h:308
bool(* ac_owns_path)(struct Account *a, const char *path)
Definition: mxapi.h:131
int(* tags_edit)(struct Mailbox *m, const char *tags, struct Buffer *buf)
Definition: mxapi.h:342
int(* msg_commit)(struct Mailbox *m, struct Message *msg)
Definition: mxapi.h:279
enum MxStatus(* mbox_check_stats)(struct Mailbox *m, CheckStatsFlags flags)
Definition: mxapi.h:202
bool(* ac_add)(struct Account *a, struct Mailbox *m)
Definition: mxapi.h:147
enum MxOpenReturns(* mbox_open)(struct Mailbox *m)
Definition: mxapi.h:160
int(* msg_close)(struct Mailbox *m, struct Message *msg)
Definition: mxapi.h:295
int(* path_canon)(char *buf, size_t buflen)
Definition: mxapi.h:389
bool(* msg_open_new)(struct Mailbox *m, struct Message *msg, const struct Email *e)
Definition: mxapi.h:263
const char * name
Mailbox name, e.g. "imap".
Definition: mxapi.h:114
enum MxStatus(* mbox_close)(struct Mailbox *m)
Definition: mxapi.h:228
enum MxStatus(* mbox_sync)(struct Mailbox *m)
Definition: mxapi.h:215
bool(* mbox_open_append)(struct Mailbox *m, OpenMailboxFlags flags)
Definition: mxapi.h:175
enum MxStatus(* mbox_check)(struct Mailbox *m)
Definition: mxapi.h:188
bool(* msg_open)(struct Mailbox *m, struct Message *msg, int msgno)
Definition: mxapi.h:246