From: Damien Riegel Date: Sat, 18 Jun 2016 20:36:21 +0000 (-0700) Subject: add imap_commit_message function X-Git-Tag: neomutt-20160822~107 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1eba3d9e0213f78302d5dd478759f22c06c6253;p=neomutt add imap_commit_message function Move IMAP operations that were done in mx_commit_message to a dedicated imap_commit_message function. --- diff --git a/imap/imap.h b/imap/imap.h index ff0a1ba01..5dcb2d686 100644 --- a/imap/imap.h +++ b/imap/imap.h @@ -58,6 +58,7 @@ int imap_mailbox_rename (const char* mailbox); /* message.c */ int imap_append_message (CONTEXT* ctx, MESSAGE* msg); int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete); +int imap_commit_message (CONTEXT *ctx, MESSAGE *msg); /* socket.c */ void imap_logout_all (void); diff --git a/imap/message.c b/imap/message.c index 917e98773..c8962e1af 100644 --- a/imap/message.c +++ b/imap/message.c @@ -600,6 +600,16 @@ int imap_close_message (CONTEXT *ctx, MESSAGE *msg) return safe_fclose (&msg->fp); } +int imap_commit_message (CONTEXT *ctx, MESSAGE *msg) +{ + int r = safe_fclose (&msg->fp); + + if (r) + return r; + + return imap_append_message (ctx, msg); +} + int imap_append_message (CONTEXT *ctx, MESSAGE *msg) { IMAP_DATA* idata; diff --git a/mx.c b/mx.c index ecbc19595..441e6a845 100644 --- a/mx.c +++ b/mx.c @@ -1357,8 +1357,7 @@ int mx_commit_message (MESSAGE *msg, CONTEXT *ctx) #ifdef USE_IMAP case MUTT_IMAP: { - if ((r = safe_fclose (&msg->fp)) == 0) - r = imap_append_message (ctx, msg); + r = imap_commit_message (ctx, msg); break; } #endif