NeoMutt  2022-04-29-247-gc6aae8
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
34struct Buffer;
35struct Email;
36
37extern const struct MxOps *mx_ops[];
38
39extern struct EnumDef MboxTypeDef;
40
41typedef uint8_t MsgOpenFlags;
42#define MUTT_MSG_NO_FLAGS 0
43#define MUTT_ADD_FROM (1 << 0)
44#define MUTT_SET_DRAFT (1 << 1)
45
46/* Wrappers for the Mailbox API, see MxOps */
47enum MxStatus mx_mbox_check (struct Mailbox *m);
48enum MxStatus mx_mbox_check_stats(struct Mailbox *m, uint8_t flags);
49enum MxStatus mx_mbox_close (struct Mailbox *m);
50bool mx_mbox_open (struct Mailbox *m, OpenMailboxFlags flags);
51enum MxStatus mx_mbox_sync (struct Mailbox *m);
52int mx_msg_close (struct Mailbox *m, struct Message **msg);
53int mx_msg_commit (struct Mailbox *m, struct Message *msg);
54struct Message *mx_msg_open_new (struct Mailbox *m, const struct Email *e, MsgOpenFlags flags);
55struct Message *mx_msg_open (struct Mailbox *m, int msgno);
56int mx_msg_padding_size(struct Mailbox *m);
57int mx_save_hcache (struct Mailbox *m, struct Email *e);
58int mx_path_canon (char *buf, size_t buflen, const char *folder, enum MailboxType *type);
59int mx_path_canon2 (struct Mailbox *m, const char *folder);
60int mx_path_parent (const char *buf, size_t buflen);
61int mx_path_pretty (char *buf, size_t buflen, const char *folder);
62enum MailboxType mx_path_probe (const char *path);
63struct Mailbox *mx_path_resolve (const char *path);
64struct Mailbox *mx_resolve (const char *path_or_name);
65int mx_tags_commit (struct Mailbox *m, struct Email *e, const char *tags);
66int mx_tags_edit (struct Mailbox *m, const char *tags, struct Buffer *buf);
67enum MailboxType mx_type (struct Mailbox *m);
68
69struct Account *mx_ac_find (struct Mailbox *m);
70struct Mailbox *mx_mbox_find (struct Account *a, const char *path);
71struct Mailbox *mx_mbox_find2 (const char *path);
72bool mx_mbox_ac_link(struct Mailbox *m);
73bool mx_ac_add (struct Account *a, struct Mailbox *m);
74int mx_ac_remove (struct Mailbox *m, bool keep_account);
75
76int mx_access (const char *path, int flags);
77void mx_alloc_memory (struct Mailbox *m);
78int mx_path_is_empty (const char *path);
79void mx_fastclose_mailbox(struct Mailbox *m, bool keep_account);
80const struct MxOps *mx_get_ops (enum MailboxType type);
81bool mx_tags_is_supported(struct Mailbox *m);
82int mx_toggle_write (struct Mailbox *m);
83
84#endif /* MUTT_MX_H */
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
MailboxType
Supported mailbox formats.
Definition: mailbox.h:41
int mx_tags_edit(struct Mailbox *m, const char *tags, struct Buffer *buf)
Start the tag editor of the mailbox.
Definition: mx.c:1280
int mx_path_parent(const char *buf, size_t buflen)
Find the parent of a mailbox path - Wrapper for MxOps::path_parent()
Definition: mx.c:1533
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
Definition: mx.c:1193
int mx_ac_remove(struct Mailbox *m, bool keep_account)
Remove a Mailbox from an Account and delete Account if empty.
Definition: mx.c:1781
int mx_access(const char *path, int flags)
Wrapper for access, checks permissions on a given mailbox.
Definition: mx.c:184
uint8_t MsgOpenFlags
Flags for mx_msg_open_new(), e.g. MUTT_ADD_FROM.
Definition: mx.h:41
int mx_msg_padding_size(struct Mailbox *m)
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size()
Definition: mx.c:1549
void mx_fastclose_mailbox(struct Mailbox *m, bool keep_account)
Free up memory associated with the Mailbox.
Definition: mx.c:430
struct EnumDef MboxTypeDef
Definition: mx.c:98
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:1800
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:1373
int mx_path_is_empty(const char *path)
Is the mailbox empty.
Definition: mx.c:1258
bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition: mx.c:304
struct Mailbox * mx_mbox_find(struct Account *a, const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1587
struct Mailbox * mx_resolve(const char *path_or_name)
Get a Mailbox from either a path or name.
Definition: mx.c:1746
bool mx_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Wrapper for MxOps::ac_add()
Definition: mx.c:1764
struct Mailbox * mx_mbox_find2(const char *path)
Find a Mailbox on an Account.
Definition: mx.c:1649
const struct MxOps * mx_get_ops(enum MailboxType type)
Get mailbox operations.
Definition: mx.c:141
bool mx_tags_is_supported(struct Mailbox *m)
Return true if mailbox support tagging.
Definition: mx.c:1317
int mx_tags_commit(struct Mailbox *m, struct Email *e, const char *tags)
Save tags to the Mailbox - Wrapper for MxOps::tags_commit()
Definition: mx.c:1300
int mx_path_pretty(char *buf, size_t buflen, const char *folder)
Abbreviate a mailbox path - Wrapper for MxOps::path_pretty()
Definition: mx.c:1505
struct Message * mx_msg_open(struct Mailbox *m, int msgno)
Return a stream pointer for a message.
Definition: mx.c:1147
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:1824
bool mx_mbox_ac_link(struct Mailbox *m)
Link a Mailbox to an existing or new Account.
Definition: mx.c:267
struct Account * mx_ac_find(struct Mailbox *m)
Find the Account owning a Mailbox.
Definition: mx.c:1563
void mx_alloc_memory(struct Mailbox *m)
Create storage for the emails.
Definition: mx.c:1219
enum MailboxType mx_type(struct Mailbox *m)
Return the type of the Mailbox.
Definition: mx.c:1837
struct Message * mx_msg_open_new(struct Mailbox *m, const struct Email *e, MsgOpenFlags flags)
Open a new message.
Definition: mx.c:1057
int mx_toggle_write(struct Mailbox *m)
Toggle the mailbox's readonly flag.
Definition: mx.c:1848
const struct MxOps * mx_ops[]
int mx_msg_commit(struct Mailbox *m, struct Message *msg)
Commit a message to a folder - Wrapper for MxOps::msg_commit()
Definition: mx.c:1172
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1327
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
Definition: mx.c:1677
int mx_path_canon2(struct Mailbox *m, const char *folder)
Canonicalise the path to realpath.
Definition: mx.c:1477
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
Definition: mx.c:1126
enum MxStatus mx_mbox_sync(struct Mailbox *m)
Save changes to mailbox.
Definition: mx.c:919
enum MxStatus mx_mbox_close(struct Mailbox *m)
Save changes and close mailbox.
Definition: mx.c:615
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
Definition: mxapi.h:60
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close()
Definition: mxapi.h:84
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
An enumeration.
Definition: enum.h:30
A mailbox.
Definition: mailbox.h:79
A local copy of an email.
Definition: mxapi.h:43
char * path
path to temp file
Definition: mxapi.h:45
struct Message::@0 flags
Flags for the Message.
Definition: mxapi.h:112
enum MailboxType type
Mailbox type, e.g. MUTT_IMAP.
Definition: mxapi.h:113