#include "config.h"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <utime.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "message.h"
#include "copy.h"
#include "edata.h"
#include "globals.h"
#include "hcache.h"
#include "mx.h"
#include "shared.h"
#include "sort.h"
Go to the source code of this file.
Functions | |
int | nm_update_filename (struct Mailbox *m, const char *old_file, const char *new_file, struct Email *e) |
Change the filename. | |
static int | maildir_sort_flags (const void *a, const void *b, void *sdata) |
Compare two flag characters - Implements sort_t -. | |
void | maildir_gen_flags (char *dest, size_t destlen, struct Email *e) |
Generate the Maildir flags for an email. | |
static FILE * | maildir_open_find_message_dir (const char *folder, const char *unique, const char *subfolder, char **newname) |
Find a message in a maildir folder. | |
FILE * | maildir_open_find_message (const char *folder, const char *msg, char **newname) |
Find a message by name. | |
static int | maildir_sync_message (struct Mailbox *m, struct Email *e) |
Sync an email to a Maildir folder. | |
bool | maildir_sync_mailbox_message (struct Mailbox *m, struct Email *e, struct HeaderCache *hc) |
Save changes to the mailbox. | |
static int | maildir_commit_message (struct Mailbox *m, struct Message *msg, struct Email *e) |
Commit a message to a maildir folder. | |
int | maildir_rewrite_message (struct Mailbox *m, struct Email *e) |
Sync a message in an Maildir folder. | |
bool | maildir_msg_open (struct Mailbox *m, struct Message *msg, struct Email *e) |
Open an email message in a Mailbox - Implements MxOps::msg_open() -. | |
bool | maildir_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() -. | |
int | maildir_msg_commit (struct Mailbox *m, struct Message *msg) |
Save changes to an email - Implements MxOps::msg_commit() -. | |
int | maildir_msg_close (struct Mailbox *m, struct Message *msg) |
Close an email - Implements MxOps::msg_close() -. | |
int | maildir_msg_save_hcache (struct Mailbox *m, struct Email *e) |
Save message to the header cache - Implements MxOps::msg_save_hcache() -. | |
Maildir Message.
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 message.c.
int nm_update_filename | ( | struct Mailbox * | m, |
const char * | old_file, | ||
const char * | new_file, | ||
struct Email * | e | ||
) |
Change the filename.
0 | Success |
-1 | Failure |
Definition at line 1763 of file notmuch.c.
void maildir_gen_flags | ( | char * | dest, |
size_t | destlen, | ||
struct Email * | e | ||
) |
Generate the Maildir flags for an email.
Definition at line 73 of file message.c.
|
static |
Find a message in a maildir folder.
[in] | folder | Base folder |
[in] | unique | Unique part of filename |
[in] | subfolder | Subfolder to search, e.g. 'cur' |
[out] | newname | File's new name |
ptr | File handle |
These functions try to find a message in a maildir folder when it has moved under our feet. Note that this code is rather expensive, but then again, it's called rarely.
Definition at line 114 of file message.c.
FILE * maildir_open_find_message | ( | const char * | folder, |
const char * | msg, | ||
char ** | newname | ||
) |
Find a message by name.
[in] | folder | Maildir path |
[in] | msg | Email path |
[out] | newname | New name, if it has moved |
ptr | File handle |
Definition at line 170 of file message.c.
Sync an email to a Maildir folder.
0 | Success |
-1 | Error |
Definition at line 217 of file message.c.
bool maildir_sync_mailbox_message | ( | struct Mailbox * | m, |
struct Email * | e, | ||
struct HeaderCache * | hc | ||
) |
Save changes to the mailbox.
true | Success |
false | Error |
Definition at line 312 of file message.c.
|
static |
Commit a message to a maildir folder.
0 | Success |
-1 | Failure |
msg->path contains the file name of a file in tmp/. We take the flags from this file's name.
m is the mail folder we commit to.
e is a header structure to which we write the message's new file name. This is used in the maildir folder sync routines. When this routine is invoked from mx_msg_commit(), e is NULL.
msg->path looks like this:
tmp/{cur,new}.neomutt-HOSTNAME-PID-COUNTER:flags
See also maildir_msg_open_new().
Definition at line 361 of file message.c.
Sync a message in an Maildir folder.
0 | Success |
-1 | Error |
Definition at line 454 of file message.c.