summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Riegel <damien.riegel@gmail.com>2016-06-18 13:36:22 -0700
committerDamien Riegel <damien.riegel@gmail.com>2016-06-18 13:36:22 -0700
commitcde08c74fdcda74927aa42b1a4cfba1b7f69e6a4 (patch)
tree5dfce5d0c5e73f17becaecded08e511e91174c8c
parent984eeab5718810e976b23f5b9c52c7fc9d8e023c (diff)
add mbox_commit_message function
Move mbox operations that were done in mx_commit_message to a dedicated mbox_commit_message function.
-rw-r--r--mbox.c10
-rw-r--r--mx.c3
-rw-r--r--mx.h1
3 files changed, 12 insertions, 2 deletions
diff --git a/mbox.c b/mbox.c
index e0b79a1a..748249d6 100644
--- a/mbox.c
+++ b/mbox.c
@@ -461,6 +461,16 @@ static int mbox_close_message (CONTEXT *ctx, MESSAGE *msg)
return 0;
}
+int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg)
+{
+ int r = fputc ('\n', msg->fp);
+
+ if (r == EOF)
+ return -1;
+
+ return 0;
+}
+
static int mbox_open_new_message (MESSAGE *msg, CONTEXT *dest, HEADER *hdr)
{
msg->fp = dest->fp;
diff --git a/mx.c b/mx.c
index 441e6a84..f712f5e5 100644
--- a/mx.c
+++ b/mx.c
@@ -1349,8 +1349,7 @@ int mx_commit_message (MESSAGE *msg, CONTEXT *ctx)
case MUTT_MBOX:
{
- if (fputc ('\n', msg->fp) == EOF)
- r = -1;
+ r = mbox_commit_message (ctx, msg);
break;
}
diff --git a/mx.h b/mx.h
index e335d206..c5885f6e 100644
--- a/mx.h
+++ b/mx.h
@@ -51,6 +51,7 @@ int mmdf_parse_mailbox (CONTEXT *);
void mbox_unlock_mailbox (CONTEXT *);
int mbox_check_empty (const char *);
void mbox_reset_atime (CONTEXT *, struct stat *);
+int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg);
int mh_sync_mailbox (CONTEXT *, int *);
int mh_check_empty (const char *);