NeoMutt  2023-03-22-27-g3cb248
Teaching an old dog new tricks
DOXYGEN
msg_commit()

Save changes to an email. More...

+ Collaboration diagram for msg_commit():

Functions

static int comp_msg_commit (struct Mailbox *m, struct Message *msg)
 Save changes to an email - Implements MxOps::msg_commit() -. More...
 
int imap_msg_commit (struct Mailbox *m, struct Message *msg)
 Save changes to an email - Implements MxOps::msg_commit() -. More...
 
static int maildir_msg_commit (struct Mailbox *m, struct Message *msg)
 Save changes to an email - Implements MxOps::msg_commit() -. More...
 
static int mh_msg_commit (struct Mailbox *m, struct Message *msg)
 Save changes to an email - Implements MxOps::msg_commit() -. More...
 
static int mbox_msg_commit (struct Mailbox *m, struct Message *msg)
 Save changes to an email - Implements MxOps::msg_commit() -. More...
 
static int mmdf_msg_commit (struct Mailbox *m, struct Message *msg)
 Save changes to an email - Implements MxOps::msg_commit() -. More...
 
static int nm_msg_commit (struct Mailbox *m, struct Message *msg)
 Save changes to an email - Implements MxOps::msg_commit() -. More...
 

Detailed Description

Save changes to an email.

Parameters
mMailbox
msgMessage to commit
Return values
0Success
-1Failure
Precondition
m is not NULL
msg is not NULL

Function Documentation

◆ comp_msg_commit()

static int comp_msg_commit ( struct Mailbox m,
struct Message msg 
)
static

Save changes to an email - Implements MxOps::msg_commit() -.

Definition at line 782 of file compress.c.

783{
784 if (!m->compress_info)
785 return -1;
786
787 struct CompressInfo *ci = m->compress_info;
788
789 const struct MxOps *ops = ci->child_ops;
790 if (!ops)
791 return -1;
792
793 /* Delegate */
794 return ops->msg_commit(m, msg);
795}
Private data for compress.
Definition: lib.h:47
const struct MxOps * child_ops
callbacks of de-compressed file
Definition: lib.h:52
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:120
Definition: mxapi.h:112
int(* msg_commit)(struct Mailbox *m, struct Message *msg)
Definition: mxapi.h:268

◆ imap_msg_commit()

int imap_msg_commit ( struct Mailbox m,
struct Message msg 
)

Save changes to an email - Implements MxOps::msg_commit() -.

Note
May also return EOF Failure, see errno

Definition at line 2144 of file message.c.

2145{
2146 int rc = mutt_file_fclose(&msg->fp);
2147 if (rc != 0)
2148 return rc;
2149
2150 return imap_append_message(m, msg);
2151}
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:149
int imap_append_message(struct Mailbox *m, struct Message *msg)
Write an email back to the server.
Definition: message.c:1528
FILE * fp
pointer to the message data
Definition: mxapi.h:44
+ Here is the call graph for this function:

◆ maildir_msg_commit()

static int maildir_msg_commit ( struct Mailbox m,
struct Message msg 
)
static

Save changes to an email - Implements MxOps::msg_commit() -.

Definition at line 1555 of file maildir.c.

1556{
1557 return maildir_commit_message(m, msg, NULL);
1558}
static int maildir_commit_message(struct Mailbox *m, struct Message *msg, struct Email *e)
Commit a message to a maildir folder.
Definition: maildir.c:237
+ Here is the call graph for this function:

◆ mh_msg_commit()

static int mh_msg_commit ( struct Mailbox m,
struct Message msg 
)
static

Save changes to an email - Implements MxOps::msg_commit() -.

Definition at line 1159 of file mh.c.

1160{
1161 return mh_commit_msg(m, msg, NULL, true);
1162}
static int mh_commit_msg(struct Mailbox *m, struct Message *msg, struct Email *e, bool updseq)
Commit a message to an MH folder.
Definition: mh.c:293
+ Here is the call graph for this function:

◆ mbox_msg_commit()

static int mbox_msg_commit ( struct Mailbox m,
struct Message msg 
)
static

Save changes to an email - Implements MxOps::msg_commit() -.

Definition at line 1615 of file mbox.c.

1616{
1617 if (fputc('\n', msg->fp) == EOF)
1618 return -1;
1619
1620 if ((fflush(msg->fp) == EOF) || (fsync(fileno(msg->fp)) == -1))
1621 {
1622 mutt_perror(_("Can't write message"));
1623 return -1;
1624 }
1625
1626 return 0;
1627}
#define mutt_perror(...)
Definition: logging.h:88
#define _(a)
Definition: message.h:28

◆ mmdf_msg_commit()

static int mmdf_msg_commit ( struct Mailbox m,
struct Message msg 
)
static

Save changes to an email - Implements MxOps::msg_commit() -.

Definition at line 1767 of file mbox.c.

1768{
1769 if (fputs(MMDF_SEP, msg->fp) == EOF)
1770 return -1;
1771
1772 if ((fflush(msg->fp) == EOF) || (fsync(fileno(msg->fp)) == -1))
1773 {
1774 mutt_perror(_("Can't write message"));
1775 return -1;
1776 }
1777
1778 return 0;
1779}
#define MMDF_SEP
Definition: lib.h:61

◆ nm_msg_commit()

static int nm_msg_commit ( struct Mailbox m,
struct Message msg 
)
static

Save changes to an email - Implements MxOps::msg_commit() -.

Return values
-1Always

Definition at line 2372 of file notmuch.c.

2373{
2374 mutt_error(_("Can't write to virtual folder"));
2375 return -1;
2376}
#define mutt_error(...)
Definition: logging.h:87