NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
mx.h
Go to the documentation of this file.
1 
25 #ifndef MUTT_MX_H
26 #define MUTT_MX_H
27 
28 #include <stdbool.h>
29 #include <stdint.h>
30 #include <stdio.h>
31 #include "config/lib.h"
32 #include "core/lib.h"
33 
34 struct Email;
35 
36 extern const struct MxOps *mx_ops[];
37 
38 extern struct EnumDef MboxTypeDef;
39 
40 typedef uint8_t MsgOpenFlags;
41 #define MUTT_MSG_NO_FLAGS 0
42 #define MUTT_ADD_FROM (1 << 0)
43 #define MUTT_SET_DRAFT (1 << 1)
44 
45 /* Wrappers for the Mailbox API, see MxOps */
46 enum MxStatus mx_mbox_check (struct Mailbox *m);
47 enum MxStatus mx_mbox_check_stats(struct Mailbox *m, uint8_t flags);
48 enum MxStatus mx_mbox_close (struct Mailbox *m);
49 bool mx_mbox_open (struct Mailbox *m, OpenMailboxFlags flags);
50 enum MxStatus mx_mbox_sync (struct Mailbox *m);
51 int mx_msg_close (struct Mailbox *m, struct Message **msg);
52 int mx_msg_commit (struct Mailbox *m, struct Message *msg);
53 struct Message *mx_msg_open_new (struct Mailbox *m, const struct Email *e, MsgOpenFlags flags);
54 struct Message *mx_msg_open (struct Mailbox *m, int msgno);
55 int mx_msg_padding_size(struct Mailbox *m);
56 int mx_save_hcache (struct Mailbox *m, struct Email *e);
57 int mx_path_canon (char *buf, size_t buflen, const char *folder, enum MailboxType *type);
58 int mx_path_canon2 (struct Mailbox *m, const char *folder);
59 int mx_path_parent (char *buf, size_t buflen);
60 int mx_path_pretty (char *buf, size_t buflen, const char *folder);
61 enum MailboxType mx_path_probe (const char *path);
62 struct Mailbox *mx_path_resolve (const char *path);
63 struct Mailbox *mx_resolve (const char *path_or_name);
64 int mx_tags_commit (struct Mailbox *m, struct Email *e, char *tags);
65 int mx_tags_edit (struct Mailbox *m, const char *tags, char *buf, size_t buflen);
66 enum MailboxType mx_type (struct Mailbox *m);
67 
68 struct Account *mx_ac_find (struct Mailbox *m);
69 struct Mailbox *mx_mbox_find (struct Account *a, const char *path);
70 struct Mailbox *mx_mbox_find2 (const char *path);
71 bool mx_mbox_ac_link(struct Mailbox *m);
72 bool mx_ac_add (struct Account *a, struct Mailbox *m);
73 int mx_ac_remove (struct Mailbox *m);
74 
75 int mx_access (const char *path, int flags);
76 void mx_alloc_memory (struct Mailbox *m);
77 int mx_path_is_empty (const char *path);
78 void mx_fastclose_mailbox(struct Mailbox *m);
79 const struct MxOps *mx_get_ops (enum MailboxType type);
80 bool mx_tags_is_supported(struct Mailbox *m);
81 int mx_toggle_write (struct Mailbox *m);
82 
83 #endif /* MUTT_MX_H */
An enumeration.
Definition: enum.h:29
struct EnumDef MboxTypeDef
Definition: mx.c:98
enum MxStatus mx_mbox_close(struct Mailbox *m)
Save changes and close mailbox.
Definition: mx.c:610
The envelope/body of an email.
Definition: email.h:37
int mx_msg_padding_size(struct Mailbox *m)
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size()
Definition: mx.c:1540
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
Definition: mx.c:1186
struct Message * mx_msg_open(struct Mailbox *m, int msgno)
return a stream pointer for a message
Definition: mx.c:1140
struct Mailbox * mx_resolve(const char *path_or_name)
Get a Mailbox from either a path or name.
Definition: mx.c:1738
A group of associated Mailboxes.
Definition: account.h:36
int mx_tags_commit(struct Mailbox *m, struct Email *e, char *tags)
Save tags to the Mailbox - Wrapper for MxOps::tags_commit()
Definition: mx.c:1290
bool mx_mbox_ac_link(struct Mailbox *m)
Link a Mailbox to an existing or new Account.
Definition: mx.c:267
int mx_path_canon(char *buf, size_t buflen, const char *folder, enum MailboxType *type)
Canonicalise a mailbox path - Wrapper for MxOps::path_canon()
Definition: mx.c:1363
Convenience wrapper for the config headers.
enum MxStatus mx_mbox_check_stats(struct Mailbox *m, uint8_t flags)
Check the statistics for a mailbox - Wrapper for MxOps::mbox_check_stats()
Definition: mx.c:1789
int mx_access(const char *path, int flags)
Wrapper for access, checks permissions on a given mailbox.
Definition: mx.c:184
Convenience wrapper for the core headers.
void mx_alloc_memory(struct Mailbox *m)
Create storage for the emails.
Definition: mx.c:1212
bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:304
enum MailboxType type
Mailbox type, e.g. MUTT_IMAP.
Definition: mxapi.h:105
int mx_ac_remove(struct Mailbox *m)
Remove a Mailbox from an Account and delete Account if empty.
Definition: mx.c:1772
bool mx_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Wrapper for MxOps::ac_add()
Definition: mx.c:1756
int mx_save_hcache(struct Mailbox *m, struct Email *e)
Save message to the header cache - Wrapper for MxOps::msg_save_hcache()
Definition: mx.c:1806
struct Message * mx_msg_open_new(struct Mailbox *m, const struct Email *e, MsgOpenFlags flags)
Open a new message.
Definition: mx.c:1054
struct Account * mx_ac_find(struct Mailbox *m)
Find the Account owning a Mailbox.
Definition: mx.c:1554
A local copy of an email.
Definition: mxapi.h:41
A mailbox.
Definition: mailbox.h:81
struct Message::@1 flags
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
Definition: mx.c:1668
enum MailboxType mx_type(struct Mailbox *m)
Return the type of the Mailbox.
Definition: mx.c:1819
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
Definition: mxapi.h:59
const struct MxOps * mx_get_ops(enum MailboxType type)
Get mailbox operations.
Definition: mx.c:141
enum MxStatus mx_mbox_sync(struct Mailbox *m)
Save changes to mailbox.
Definition: mx.c:916
struct Mailbox * mx_mbox_find(struct Account *a, const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1578
void mx_fastclose_mailbox(struct Mailbox *m)
free up memory associated with the Mailbox
Definition: mx.c:429
uint8_t MsgOpenFlags
Flags for mx_msg_open_new(), e.g. MUTT_ADD_FROM.
Definition: mx.h:40
struct Mailbox * mx_mbox_find2(const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1640
int mx_path_pretty(char *buf, size_t buflen, const char *folder)
Abbreviate a mailbox path - Wrapper for MxOps::path_pretty()
Definition: mx.c:1496
int mx_path_parent(char *buf, size_t buflen)
Find the parent of a mailbox path - Wrapper for MxOps::path_parent()
Definition: mx.c:1524
uint8_t flags
e.g. MB_NORMAL
Definition: mailbox.h:134
MailboxType
Supported mailbox formats.
Definition: mailbox.h:43
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
Definition: mx.c:1119
int mx_tags_edit(struct Mailbox *m, const char *tags, char *buf, size_t buflen)
start the tag editor of the mailbox
Definition: mx.c:1270
int mx_msg_commit(struct Mailbox *m, struct Message *msg)
Commit a message to a folder - Wrapper for MxOps::msg_commit()
Definition: mx.c:1165
int mx_toggle_write(struct Mailbox *m)
Toggle the mailbox&#39;s readonly flag.
Definition: mx.c:1830
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close() ...
Definition: mxapi.h:75
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1317
int mx_path_canon2(struct Mailbox *m, const char *folder)
Canonicalise the path to realpath.
Definition: mx.c:1468
char * path
path to temp file
Definition: mxapi.h:44
int mx_path_is_empty(const char *path)
Is the mailbox empty.
Definition: mx.c:1247
Definition: mxapi.h:103
bool mx_tags_is_supported(struct Mailbox *m)
return true if mailbox support tagging
Definition: mx.c:1307