NeoMutt  2021-02-05-666-ge300cd
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 770 of file compress.c.

771 {
772  if (!m->compress_info)
773  return -1;
774 
775  struct CompressInfo *ci = m->compress_info;
776 
777  const struct MxOps *ops = ci->child_ops;
778  if (!ops)
779  return -1;
780 
781  /* Delegate */
782  return ops->msg_commit(m, msg);
783 }
int(* msg_commit)(struct Mailbox *m, struct Message *msg)
Definition: mxapi.h:271
Private data for compress.
Definition: lib.h:46
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:124
const struct MxOps * child_ops
callbacks of de-compressed file
Definition: lib.h:52
Definition: mxapi.h:103

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

2132 {
2133  int rc = mutt_file_fclose(&msg->fp);
2134  if (rc != 0)
2135  return rc;
2136 
2137  return imap_append_message(m, msg);
2138 }
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:153
int imap_append_message(struct Mailbox *m, struct Message *msg)
Write an email back to the server.
Definition: message.c:1511
FILE * fp
pointer to the message data
Definition: mxapi.h:43
+ 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 1553 of file maildir.c.

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

1150 {
1151  return mh_commit_msg(m, msg, NULL, true);
1152 }
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 1593 of file mbox.c.

1594 {
1595  if (fputc('\n', msg->fp) == EOF)
1596  return -1;
1597 
1598  if ((fflush(msg->fp) == EOF) || (fsync(fileno(msg->fp)) == -1))
1599  {
1600  mutt_perror(_("Can't write message"));
1601  return -1;
1602  }
1603 
1604  return 0;
1605 }
#define _(a)
Definition: message.h:28
#define mutt_perror(...)
Definition: logging.h:89
FILE * fp
pointer to the message data
Definition: mxapi.h:43

◆ 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 1746 of file mbox.c.

1747 {
1748  if (fputs(MMDF_SEP, msg->fp) == EOF)
1749  return -1;
1750 
1751  if ((fflush(msg->fp) == EOF) || (fsync(fileno(msg->fp)) == -1))
1752  {
1753  mutt_perror(_("Can't write message"));
1754  return -1;
1755  }
1756 
1757  return 0;
1758 }
#define _(a)
Definition: message.h:28
#define mutt_perror(...)
Definition: logging.h:89
#define MMDF_SEP
Definition: lib.h:60
FILE * fp
pointer to the message data
Definition: mxapi.h:43

◆ 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 2388 of file notmuch.c.

2389 {
2390  mutt_error(_("Can't write to virtual folder"));
2391  return -1;
2392 }
#define mutt_error(...)
Definition: logging.h:88
#define _(a)
Definition: message.h:28