API for mailboxes. More...
Go to the source code of this file.
Macros | |
#define | MUTT_MSG_NO_FLAGS 0 |
No flags are set. | |
#define | MUTT_ADD_FROM (1 << 0) |
add a From_ line | |
#define | MUTT_SET_DRAFT (1 << 1) |
set the message draft flag | |
Typedefs | |
typedef uint8_t | MsgOpenFlags |
Flags for mx_msg_open_new(), e.g. MUTT_ADD_FROM. | |
Functions | |
enum MxStatus | mx_mbox_check (struct Mailbox *m) |
Check for new mail - Wrapper for MxOps::mbox_check() | |
enum MxStatus | mx_mbox_check_stats (struct Mailbox *m, uint8_t flags) |
Check the statistics for a mailbox - Wrapper for MxOps::mbox_check_stats() | |
enum MxStatus | mx_mbox_close (struct Mailbox *m) |
Save changes and close mailbox. | |
bool | mx_mbox_open (struct Mailbox *m, OpenMailboxFlags flags) |
Open a mailbox and parse it. | |
enum MxStatus | mx_mbox_sync (struct Mailbox *m) |
Save changes to mailbox. | |
int | mx_msg_close (struct Mailbox *m, struct Message **ptr) |
Close a message. | |
int | mx_msg_commit (struct Mailbox *m, struct Message *msg) |
Commit a message to a folder - Wrapper for MxOps::msg_commit() | |
struct Message * | mx_msg_open_new (struct Mailbox *m, const struct Email *e, MsgOpenFlags flags) |
Open a new message. | |
struct Message * | mx_msg_open (struct Mailbox *m, struct Email *e) |
Return a stream pointer for a message. | |
int | mx_msg_padding_size (struct Mailbox *m) |
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size() | |
int | mx_save_hcache (struct Mailbox *m, struct Email *e) |
Save message to the header cache - Wrapper for MxOps::msg_save_hcache() | |
int | mx_path_canon (struct Buffer *path, const char *folder, enum MailboxType *type) |
Canonicalise a mailbox path - Wrapper for MxOps::path_canon() | |
int | mx_path_canon2 (struct Mailbox *m, const char *folder) |
Canonicalise the path to realpath. | |
enum MailboxType | mx_path_probe (const char *path) |
Find a mailbox that understands a path. | |
struct Mailbox * | mx_path_resolve (const char *path) |
Get a Mailbox for a path. | |
struct Mailbox * | mx_resolve (const char *path_or_name) |
Get a Mailbox from either a path or name. | |
int | mx_tags_commit (struct Mailbox *m, struct Email *e, const char *tags) |
Save tags to the Mailbox - Wrapper for MxOps::tags_commit() | |
int | mx_tags_edit (struct Mailbox *m, const char *tags, struct Buffer *buf) |
Start the tag editor of the mailbox. | |
enum MailboxType | mx_type (struct Mailbox *m) |
Return the type of the Mailbox. | |
struct Account * | mx_ac_find (struct Mailbox *m) |
Find the Account owning a Mailbox. | |
struct Mailbox * | mx_mbox_find (struct Account *a, const char *path) |
Find a Mailbox on an Account. | |
struct Mailbox * | mx_mbox_find2 (const char *path) |
Find a Mailbox on an Account. | |
bool | mx_mbox_ac_link (struct Mailbox *m) |
Link a Mailbox to an existing or new Account. | |
bool | mx_ac_add (struct Account *a, struct Mailbox *m) |
Add a Mailbox to an Account - Wrapper for MxOps::ac_add() | |
int | mx_ac_remove (struct Mailbox *m, bool keep_account) |
Remove a Mailbox from an Account and delete Account if empty. | |
int | mx_access (const char *path, int flags) |
Wrapper for access, checks permissions on a given mailbox. | |
void | mx_alloc_memory (struct Mailbox *m, int req_size) |
Create storage for the emails. | |
int | mx_path_is_empty (struct Buffer *path) |
Is the mailbox empty. | |
void | mx_fastclose_mailbox (struct Mailbox *m, bool keep_account) |
Free up memory associated with the Mailbox. | |
const struct MxOps * | mx_get_ops (enum MailboxType type) |
Get mailbox operations. | |
bool | mx_tags_is_supported (struct Mailbox *m) |
Return true if mailbox support tagging. | |
int | mx_toggle_write (struct Mailbox *m) |
Toggle the mailbox's readonly flag. | |
Variables | |
const struct EnumDef | MboxTypeDef |
Data for the $mbox_type enumeration. | |
API for mailboxes.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file mx.h.
typedef uint8_t MsgOpenFlags |
Flags for mx_msg_open_new(), e.g. MUTT_ADD_FROM.
Check for new mail - Wrapper for MxOps::mbox_check()
m | Mailbox |
enum | MxStatus |
Definition at line 1105 of file mx.c.
Check the statistics for a mailbox - Wrapper for MxOps::mbox_check_stats()
Definition at line 1759 of file mx.c.
Save changes and close mailbox.
m | Mailbox |
enum | MxStatus |
Definition at line 598 of file mx.c.
bool mx_mbox_open | ( | struct Mailbox * | m, |
OpenMailboxFlags | flags | ||
) |
Open a mailbox and parse it.
m | Mailbox to open |
flags | Flags, see OpenMailboxFlags |
true | Success |
false | Error |
Definition at line 288 of file mx.c.
Save changes to mailbox.
[in] | m | Mailbox |
enum | MxStatus |
Definition at line 906 of file mx.c.
Close a message.
0 | Success |
-1 | Failure |
Definition at line 1180 of file mx.c.
Commit a message to a folder - Wrapper for MxOps::msg_commit()
0 | Success |
-1 | Failure |
Definition at line 1159 of file mx.c.
struct Message * mx_msg_open_new | ( | struct Mailbox * | m, |
const struct Email * | e, | ||
MsgOpenFlags | flags | ||
) |
Open a new message.
m | Destination mailbox |
e | Message being copied (required for maildir support, because the filename depends on the message flags) |
flags | Flags, see MsgOpenFlags |
ptr | New Message |
Definition at line 1040 of file mx.c.
Return a stream pointer for a message.
ptr | Message |
NULL | Error |
Definition at line 1134 of file mx.c.
int mx_msg_padding_size | ( | struct Mailbox * | m | ) |
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size()
m | Mailbox |
num | Number of bytes of padding |
mmdf and mbox add separators, which leads a small discrepancy when computing vsize for a limited view.
Definition at line 1505 of file mx.c.
Save message to the header cache - Wrapper for MxOps::msg_save_hcache()
0 | Success |
-1 | Failure |
Write a single header out to the header cache.
Definition at line 1783 of file mx.c.
int mx_path_canon | ( | struct Buffer * | path, |
const char * | folder, | ||
enum MailboxType * | type | ||
) |
Canonicalise a mailbox path - Wrapper for MxOps::path_canon()
Definition at line 1367 of file mx.c.
int mx_path_canon2 | ( | struct Mailbox * | m, |
const char * | folder | ||
) |
Canonicalise the path to realpath.
m | Mailbox |
folder | Path to canonicalise |
0 | Success |
-1 | Failure |
Definition at line 1471 of file mx.c.
enum MailboxType mx_path_probe | ( | const char * | path | ) |
Find a mailbox that understands a path.
path | Path to examine |
enum | MailboxType, e.g. MUTT_IMAP |
Definition at line 1321 of file mx.c.
struct Mailbox * mx_path_resolve | ( | const char * | path | ) |
Get a Mailbox for a path.
path | Mailbox path |
ptr | Mailbox |
If there isn't a Mailbox for the path, one will be created.
Definition at line 1636 of file mx.c.
struct Mailbox * mx_resolve | ( | const char * | path_or_name | ) |
Get a Mailbox from either a path or name.
path_or_name | Mailbox path or name |
ptr | Mailbox |
Order of resolving:
Definition at line 1705 of file mx.c.
Save tags to the Mailbox - Wrapper for MxOps::tags_commit()
0 | Success |
-1 | Failure |
Definition at line 1294 of file mx.c.
Start the tag editor of the mailbox.
-1 | Error |
0 | No valid user input |
1 | Buffer set |
Definition at line 1274 of file mx.c.
enum MailboxType mx_type | ( | struct Mailbox * | m | ) |
Return the type of the Mailbox.
m | Mailbox |
enum | MailboxType |
Definition at line 1796 of file mx.c.
a | Account to search |
path | Path to find |
ptr | Mailbox |
Definition at line 1543 of file mx.c.
struct Mailbox * mx_mbox_find2 | ( | const char * | path | ) |
path | Path to find |
ptr | Mailbox |
NULL | No match |
Definition at line 1605 of file mx.c.
bool mx_mbox_ac_link | ( | struct Mailbox * | m | ) |
Link a Mailbox to an existing or new Account.
m | Mailbox to link |
true | Success |
false | Failure |
Definition at line 251 of file mx.c.
Add a Mailbox to an Account - Wrapper for MxOps::ac_add()
Definition at line 1723 of file mx.c.
int mx_ac_remove | ( | struct Mailbox * | m, |
bool | keep_account | ||
) |
Remove a Mailbox from an Account and delete Account if empty.
m | Mailbox to remove |
keep_account | Make sure not to remove the mailbox's account |
0 | Success |
-1 | Error |
Definition at line 1740 of file mx.c.
int mx_access | ( | const char * | path, |
int | flags | ||
) |
Wrapper for access, checks permissions on a given mailbox.
path | Path of mailbox |
flags | Flags, e.g. W_OK |
0 | Success, allowed |
<0 | Failure, not allowed |
We may be interested in using ACL-style flags at some point, currently we use the normal access() flags.
Definition at line 170 of file mx.c.
void mx_alloc_memory | ( | struct Mailbox * | m, |
int | req_size | ||
) |
Create storage for the emails.
m | Mailbox |
req_size | Space required |
Definition at line 1206 of file mx.c.
int mx_path_is_empty | ( | struct Buffer * | path | ) |
void mx_fastclose_mailbox | ( | struct Mailbox * | m, |
bool | keep_account | ||
) |
Free up memory associated with the Mailbox.
m | Mailbox |
keep_account | Make sure not to remove the mailbox's account |
Definition at line 414 of file mx.c.
const struct MxOps * mx_get_ops | ( | enum MailboxType | type | ) |
bool mx_tags_is_supported | ( | struct Mailbox * | m | ) |
int mx_toggle_write | ( | struct Mailbox * | m | ) |
Toggle the mailbox's readonly flag.
m | Mailbox |
0 | Success |
-1 | Error |
Definition at line 1807 of file mx.c.