MH local mailbox type. More...
#include "config.h"#include <dirent.h>#include <errno.h>#include <fcntl.h>#include <inttypes.h>#include <limits.h>#include <stdbool.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>#include <unistd.h>#include "mutt/lib.h"#include "config/lib.h"#include "email/lib.h"#include "core/lib.h"#include "mutt.h"#include "progress/lib.h"#include "copy.h"#include "mdata.h"#include "mhemail.h"#include "mx.h"#include "protos.h"#include "sequence.h"#include "shared.h"#include "monitor.h"#include "hcache/lib.h"
Include dependency graph for mh.c:Go to the source code of this file.
Functions | |
| static int | mh_already_notified (struct Mailbox *m, int msgno) |
| Has the message changed. | |
| static bool | mh_valid_message (const char *s) |
| Is this a valid MH message filename. | |
| int | mh_check_empty (struct Buffer *path) |
| Is mailbox empty. | |
| static enum MxStatus | mh_mbox_check_stats (struct Mailbox *m, uint8_t flags) |
| Check the Mailbox statistics - Implements MxOps::mbox_check_stats() -. | |
| static void | mh_update_emails (struct MhEmailArray *mha, struct MhSequences *mhs) |
| Update our record of flags. | |
| static int | mh_commit_msg (struct Mailbox *m, struct Message *msg, struct Email *e, bool updseq) |
| Commit a message to an MH folder. | |
| static int | mh_rewrite_message (struct Mailbox *m, struct Email *e) |
| Sync a message in an MH folder. | |
| static int | mh_sync_message (struct Mailbox *m, struct Email *e) |
| Sync an email to an MH folder. | |
| static void | mh_update_mtime (struct Mailbox *m) |
| Update our record of the mailbox modification time. | |
| static int | mh_parse_dir (struct Mailbox *m, struct MhEmailArray *mha, struct Progress *progress) |
| Read an Mh mailbox. | |
| static int | mh_sort_path (const void *a, const void *b, void *sdata) |
| Compare two Mh Mailboxes by path - Implements sort_t -. | |
| static struct Email * | mh_parse_message (const char *fname, struct Email *e) |
| Actually parse an MH message. | |
| static void | mh_delayed_parsing (struct Mailbox *m, struct MhEmailArray *mha, struct Progress *progress) |
| This function does the second parsing pass. | |
| static int | mh_move_to_mailbox (struct Mailbox *m, const struct MhEmailArray *mha) |
| Copy the Mh list to the Mailbox. | |
| static bool | mh_read_dir (struct Mailbox *m) |
| Read an MH mailbox. | |
| int | mh_sync_mailbox_message (struct Mailbox *m, struct Email *e, struct HeaderCache *hc) |
| Save changes to the mailbox. | |
| static int | mh_msg_save_hcache (struct Mailbox *m, struct Email *e) |
| Save message to the header cache - Implements MxOps::msg_save_hcache() -. | |
| static bool | mh_ac_owns_path (struct Account *a, const char *path) |
| Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -. | |
| static bool | mh_ac_add (struct Account *a, struct Mailbox *m) |
| Add a Mailbox to an Account - Implements MxOps::ac_add() -. | |
| static enum MxOpenReturns | mh_mbox_open (struct Mailbox *m) |
| Open a Mailbox - Implements MxOps::mbox_open() -. | |
| static bool | mh_mbox_open_append (struct Mailbox *m, OpenMailboxFlags flags) |
| Open a Mailbox for appending - Implements MxOps::mbox_open_append() -. | |
| static bool | mh_update_flags (struct Mailbox *m, struct Email *e_old, struct Email *e_new) |
| Update the mailbox flags. | |
| static enum MxStatus | mh_check (struct Mailbox *m) |
| Check for new mail. | |
| static enum MxStatus | mh_mbox_check (struct Mailbox *m) |
| Check for new mail - Implements MxOps::mbox_check() -. | |
| static enum MxStatus | mh_mbox_sync (struct Mailbox *m) |
| Save changes to the Mailbox - Implements MxOps::mbox_sync() -. | |
| static enum MxStatus | mh_mbox_close (struct Mailbox *m) |
| Close a Mailbox - Implements MxOps::mbox_close() -. | |
| static bool | mh_msg_open (struct Mailbox *m, struct Message *msg, struct Email *e) |
| Open an email message in a Mailbox - Implements MxOps::msg_open() -. | |
| static bool | mh_msg_open_new (struct Mailbox *m, struct Message *msg, const struct Email *e) |
| Open a new message in a Mailbox - Implements MxOps::msg_open_new() -. | |
| static int | mh_msg_commit (struct Mailbox *m, struct Message *msg) |
| Save changes to an email - Implements MxOps::msg_commit() -. | |
| static int | mh_msg_close (struct Mailbox *m, struct Message *msg) |
| Close an email - Implements MxOps::msg_close() -. | |
| static int | mh_path_canon (struct Buffer *path) |
| Canonicalise a Mailbox path - Implements MxOps::path_canon() -. | |
| static enum MailboxType | mh_path_probe (const char *path, const struct stat *st) |
| Is this an mh Mailbox? | |
Variables | |
| const struct MxOps | MxMhOps |
| MH Mailbox - Implements MxOps -. | |
MH local mailbox type.
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 mh.c.
|
static |
Has the message changed.
| 1 | Modification time on the message file is older than the last visit to this mailbox |
| 0 | Modification time on the message file is newer |
| -1 | Error |
Definition at line 78 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Is this a valid MH message filename.
| s | Pathname to examine |
| true | name is valid |
| false | name is invalid |
Ignore the garbage files. A valid MH message consists of only digits. Deleted message get moved to a filename with a comma before it.
Definition at line 100 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int mh_check_empty | ( | struct Buffer * | path | ) |
Is mailbox empty.
| path | Mailbox to check |
Definition at line 117 of file mh.c.
Here is the call graph for this function:
|
static |
Update our record of flags.
| mha | Mh array to update |
| mhs | Sequences |
Definition at line 211 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Commit a message to an MH folder.
| 0 | Success |
| -1 | Failure |
Definition at line 244 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:Sync a message in an MH folder.
| 0 | Success |
| -1 | Error |
Definition at line 324 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:Sync an email to an MH folder.
| 0 | Success |
| -1 | Error |
Definition at line 398 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Update our record of the mailbox modification time.
| m | Mailbox |
Definition at line 417 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Read an Mh mailbox.
| [in] | m | Mailbox |
| [out] | mha | Array for results |
| [in] | progress | Progress bar |
| 0 | Success |
| -1 | Error |
| -2 | Aborted |
Definition at line 442 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:Actually parse an MH message.
| ptr | Populated Email |
This may also be used to fill out a fake header structure generated by lazy mh parsing.
Definition at line 510 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
This function does the second parsing pass.
| [in] | m | Mailbox |
| [out] | mha | Mh array to parse |
| [in] | progress | Progress bar |
Definition at line 547 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Copy the Mh list to the Mailbox.
| [in] | m | Mailbox |
| [out] | mha | Mh array to copy, then free |
| num | Number of new emails |
| 0 | Error |
Definition at line 618 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Read an MH mailbox.
| m | Mailbox |
| true | Success |
| false | Error |
Definition at line 661 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int mh_sync_mailbox_message | ( | struct Mailbox * | m, |
| struct Email * | e, | ||
| struct HeaderCache * | hc ) |
Save changes to the mailbox.
| 0 | Success |
| -1 | Error |
Definition at line 726 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Update the mailbox flags.
| true | The flags changed |
| false | Otherwise |
Definition at line 856 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function:Check for new mail.
| m | Mailbox |
| enum | MxStatus |
This function handles arrival of new mail and reopening of mh folders. Things are getting rather complex because we don't have a well-defined "mailbox order", so the tricks from mbox.c and mx.c won't work here.
Don't change this code unless you really understand what happens.
Definition at line 907 of file mh.c.
Here is the call graph for this function:
Here is the caller graph for this function: