NeoMutt  2022-04-29-247-gc6aae8
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

Contract

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 776 of file compress.c.

777{
778 if (!m->compress_info)
779 return -1;
780
781 struct CompressInfo *ci = m->compress_info;
782
783 const struct MxOps *ops = ci->child_ops;
784 if (!ops)
785 return -1;
786
787 /* Delegate */
788 return ops->msg_commit(m, msg);
789}
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:279

◆ 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 2167 of file message.c.

2168{
2169 int rc = mutt_file_fclose(&msg->fp);
2170 if (rc != 0)
2171 return rc;
2172
2173 return imap_append_message(m, msg);
2174}
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:152
int imap_append_message(struct Mailbox *m, struct Message *msg)
Write an email back to the server.
Definition: message.c:1551
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 1551 of file maildir.c.

1552{
1553 return maildir_commit_message(m, msg, NULL);
1554}
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 1156 of file mh.c.

1157{
1158 return mh_commit_msg(m, msg, NULL, true);
1159}
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 1603 of file mbox.c.

1604{
1605 if (fputc('\n', msg->fp) == EOF)
1606 return -1;
1607
1608 if ((fflush(msg->fp) == EOF) || (fsync(fileno(msg->fp)) == -1))
1609 {
1610 mutt_perror(_("Can't write message"));
1611 return -1;
1612 }
1613
1614 return 0;
1615}
#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 1755 of file mbox.c.

1756{
1757 if (fputs(MMDF_SEP, msg->fp) == EOF)
1758 return -1;
1759
1760 if ((fflush(msg->fp) == EOF) || (fsync(fileno(msg->fp)) == -1))
1761 {
1762 mutt_perror(_("Can't write message"));
1763 return -1;
1764 }
1765
1766 return 0;
1767}
#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 2362 of file notmuch.c.

2363{
2364 mutt_error(_("Can't write to virtual folder"));
2365 return -1;
2366}
#define mutt_error(...)
Definition: logging.h:87