NeoMutt  2021-02-05-329-g9e03b7
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 
34 struct Account;
35 struct Email;
36 struct stat;
37 
41 struct Message
42 {
43  FILE *fp;
44  char *path;
46  bool write;
47  struct
48  {
49  bool read : 1;
50  bool flagged : 1;
51  bool replied : 1;
52  bool draft : 1;
53  } flags;
54  time_t received;
55 };
56 
57 
58 /* flags for mutt_open_mailbox() */
59 typedef uint8_t OpenMailboxFlags;
60 #define MUTT_OPEN_NO_FLAGS 0
61 #define MUTT_NOSORT (1 << 0)
62 #define MUTT_APPEND (1 << 1)
63 #define MUTT_READONLY (1 << 2)
64 #define MUTT_QUIET (1 << 3)
65 #define MUTT_NEWFOLDER (1 << 4)
66 #define MUTT_PEEK (1 << 5)
69 #define MUTT_APPENDNEW (1 << 6)
70 
75 enum MxStatus
76 {
83 };
84 
89 {
93 };
94 
101 struct MxOps
102 {
103  enum MailboxType type;
104  const char *name;
105  bool is_local;
106 
118  bool (*ac_owns_path)(struct Account *a, const char *path);
119 
131  bool (*ac_add)(struct Account *a, struct Mailbox *m);
132 
141  enum MxOpenReturns (*mbox_open)(struct Mailbox *m);
142 
153  bool (*mbox_open_append)(struct Mailbox *m, OpenMailboxFlags flags);
154 
163  enum MxStatus (*mbox_check)(struct Mailbox *m);
164 
174  enum MxStatus (*mbox_check_stats)(struct Mailbox *m, uint8_t flags);
175 
184  enum MxStatus (*mbox_sync)(struct Mailbox *m);
185 
194  enum MxStatus (*mbox_close)(struct Mailbox *m);
195 
209  bool (*msg_open)(struct Mailbox *m, struct Message *msg, int msgno);
210 
223  bool (*msg_open_new)(struct Mailbox *m, struct Message *msg, const struct Email *e);
224 
236  int (*msg_commit) (struct Mailbox *m, struct Message *msg);
237 
249  int (*msg_close) (struct Mailbox *m, struct Message *msg);
250 
259  int (*msg_padding_size)(struct Mailbox *m);
260 
272  int (*msg_save_hcache) (struct Mailbox *m, struct Email *e);
273 
288  int (*tags_edit) (struct Mailbox *m, const char *tags, char *buf, size_t buflen);
289 
303  int (*tags_commit) (struct Mailbox *m, struct Email *e, char *buf);
304 
314  enum MailboxType (*path_probe)(const char *path, const struct stat *st);
315 
326  int (*path_canon) (char *buf, size_t buflen);
327 
339  int (*path_pretty) (char *buf, size_t buflen, const char *folder);
340 
351  int (*path_parent) (char *buf, size_t buflen);
352 
363  int (*path_is_empty) (const char *path);
364 };
365 
366 #endif /* MUTT_CORE_MXAPI_H */
367 
bool is_local
True, if Mailbox type has local files/dirs.
Definition: mxapi.h:105
The envelope/body of an email.
Definition: email.h:37
bool replied
Definition: mxapi.h:51
A group of associated Mailboxes.
Definition: account.h:36
Nondestructive flags change (IMAP)
Definition: mxapi.h:82
New mail received in Mailbox.
Definition: mxapi.h:79
MxOpenReturns
Return values for mbox_open()
Definition: mxapi.h:88
Open succeeded.
Definition: mxapi.h:90
Mailbox was reopened.
Definition: mxapi.h:81
enum MxStatus mbox_check(struct Mailbox *m, struct stat *sb, bool check_stats)
bool flagged
Definition: mxapi.h:50
A local copy of an email.
Definition: mxapi.h:41
A mailbox.
Definition: mailbox.h:81
struct Message::@1 flags
No changes.
Definition: mxapi.h:78
Open was aborted.
Definition: mxapi.h:92
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
Definition: mxapi.h:59
Couldn&#39;t lock the Mailbox.
Definition: mxapi.h:80
bool draft
Definition: mxapi.h:52
bool write
nonzero if message is open for writing
Definition: mxapi.h:46
const char * name
Mailbox name, e.g. "imap".
Definition: mxapi.h:104
char * committed_path
the final path generated by mx_msg_commit()
Definition: mxapi.h:45
Representation of a mailbox.
MailboxType
Supported mailbox formats.
Definition: mailbox.h:43
FILE * fp
pointer to the message data
Definition: mxapi.h:43
time_t received
the time at which this message was received
Definition: mxapi.h:54
Open failed with an error.
Definition: mxapi.h:91
bool read
Definition: mxapi.h:49
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close() ...
Definition: mxapi.h:75
char * path
path to temp file
Definition: mxapi.h:44
The Mailbox API.
Definition: mxapi.h:101
An error occurred.
Definition: mxapi.h:77