#include "config.h"
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "mx.h"
#include "compmbox/lib.h"
#include "imap/lib.h"
#include "key/lib.h"
#include "maildir/lib.h"
#include "mbox/lib.h"
#include "menu/lib.h"
#include "mh/lib.h"
#include "nntp/lib.h"
#include "pop/lib.h"
#include "question/lib.h"
#include "copy.h"
#include "external.h"
#include "globals.h"
#include "hook.h"
#include "mutt_header.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
#include "muttlib.h"
#include "nntp/mdata.h"
#include "protos.h"
#include "notmuch/lib.h"
#include <libintl.h>
Go to the source code of this file.
Functions | |
const struct MxOps * | mx_get_ops (enum MailboxType type) |
Get mailbox operations. | |
static bool | mutt_is_spool (const char *str) |
Is this the spool_file? | |
int | mx_access (const char *path, int flags) |
Wrapper for access, checks permissions on a given mailbox. | |
static bool | mx_open_mailbox_append (struct Mailbox *m, OpenMailboxFlags flags) |
Open a mailbox for appending. | |
bool | mx_mbox_ac_link (struct Mailbox *m) |
Link a Mailbox to an existing or new Account. | |
bool | mx_mbox_open (struct Mailbox *m, OpenMailboxFlags flags) |
Open a mailbox and parse it. | |
void | mx_fastclose_mailbox (struct Mailbox *m, bool keep_account) |
Free up memory associated with the Mailbox. | |
static enum MxStatus | sync_mailbox (struct Mailbox *m) |
Save changes to disk. | |
static int | trash_append (struct Mailbox *m) |
Move deleted mails to the trash folder. | |
enum MxStatus | mx_mbox_close (struct Mailbox *m) |
Save changes and close mailbox. | |
enum MxStatus | mx_mbox_sync (struct Mailbox *m) |
Save changes to mailbox. | |
struct Message * | mx_msg_open_new (struct Mailbox *m, const struct Email *e, MsgOpenFlags flags) |
Open a new message. | |
enum MxStatus | mx_mbox_check (struct Mailbox *m) |
Check for new mail - Wrapper for MxOps::mbox_check() | |
struct Message * | mx_msg_open (struct Mailbox *m, struct Email *e) |
Return a stream pointer for a message. | |
int | mx_msg_commit (struct Mailbox *m, struct Message *msg) |
Commit a message to a folder - Wrapper for MxOps::msg_commit() | |
int | mx_msg_close (struct Mailbox *m, struct Message **ptr) |
Close a message. | |
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. | |
int | mx_tags_edit (struct Mailbox *m, const char *tags, struct Buffer *buf) |
Start the tag editor of the mailbox. | |
int | mx_tags_commit (struct Mailbox *m, struct Email *e, const char *tags) |
Save tags to the Mailbox - Wrapper for MxOps::tags_commit() | |
bool | mx_tags_is_supported (struct Mailbox *m) |
Return true if mailbox support tagging. | |
enum MailboxType | mx_path_probe (const char *path) |
Find a mailbox that understands a path. | |
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. | |
int | mx_msg_padding_size (struct Mailbox *m) |
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size() | |
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. | |
struct Mailbox * | mx_path_resolve (const char *path) |
Get a Mailbox for a path. | |
static struct Mailbox * | mx_mbox_find_by_name_ac (struct Account *a, const char *name) |
Find a Mailbox with given name under an Account. | |
static struct Mailbox * | mx_mbox_find_by_name (const char *name) |
Find a Mailbox with given name. | |
struct Mailbox * | mx_resolve (const char *path_or_name) |
Get a Mailbox from either a path or name. | |
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. | |
enum MxStatus | mx_mbox_check_stats (struct Mailbox *m, uint8_t flags) |
Check the statistics for a mailbox - Wrapper for MxOps::mbox_check_stats() | |
int | mx_save_hcache (struct Mailbox *m, struct Email *e) |
Save message to the header cache - Wrapper for MxOps::msg_save_hcache() | |
enum MailboxType | mx_type (struct Mailbox *m) |
Return the type of the Mailbox. | |
int | mx_toggle_write (struct Mailbox *m) |
Toggle the mailbox's readonly flag. | |
Variables | |
static const struct Mapping | MboxTypeMap [] |
Lookup table of mailbox types. | |
const struct EnumDef | MboxTypeDef |
Data for the $mbox_type enumeration. | |
static const struct MxOps * | MxOps [] |
All the Mailbox backends. | |
Mailbox multiplexor.
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.c.
const struct MxOps * mx_get_ops | ( | enum MailboxType | type | ) |
Get mailbox operations.
type | Mailbox type |
ptr | Mailbox function |
NULL | Error |
Definition at line 127 of file mx.c.
|
static |
Is this the spool_file?
str | Name to check |
true | It is the spool_file |
Definition at line 141 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.
|
static |
Open a mailbox for appending.
m | Mailbox |
flags | Flags, see OpenMailboxFlags |
true | Success |
false | Failure |
Definition at line 185 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.
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.
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.
Save changes to disk.
m | Mailbox |
enum | MxStatus |
Definition at line 456 of file mx.c.
|
static |
Move deleted mails to the trash folder.
m | Mailbox |
0 | Success |
-1 | Failure |
Definition at line 487 of file mx.c.
Save changes and close mailbox.
m | Mailbox |
enum | MxStatus |
Definition at line 598 of file mx.c.
Save changes to mailbox.
[in] | m | Mailbox |
enum | MxStatus |
Definition at line 906 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.
Check for new mail - Wrapper for MxOps::mbox_check()
m | Mailbox |
enum | MxStatus |
Definition at line 1105 of file mx.c.
Return a stream pointer for a message.
ptr | Message |
NULL | Error |
Definition at line 1134 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.
Close a message.
0 | Success |
-1 | Failure |
Definition at line 1180 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 | ) |
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.
Save tags to the Mailbox - Wrapper for MxOps::tags_commit()
0 | Success |
-1 | Failure |
Definition at line 1294 of file mx.c.
bool mx_tags_is_supported | ( | struct Mailbox * | m | ) |
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.
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.
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.
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.
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.
Find a Mailbox with given name under an Account.
a | Account to search |
name | Name to find |
ptr | Mailbox |
Definition at line 1659 of file mx.c.
|
static |
Find a Mailbox with given name.
name | Name to search |
ptr | Mailbox |
Definition at line 1680 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.
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.
Check the statistics for a mailbox - Wrapper for MxOps::mbox_check_stats()
Definition at line 1759 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.
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.
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.
|
static |
const struct EnumDef MboxTypeDef |
Data for the $mbox_type enumeration.
All the Mailbox backends.