summaryrefslogtreecommitdiffstats
path: root/imap
diff options
context:
space:
mode:
authorDamien Riegel <damien@riegel.io>2016-05-25 15:53:07 -0700
committerDamien Riegel <damien@riegel.io>2016-05-25 15:53:07 -0700
commit802f2d765ded0df5a6e6789e9a55239efda84461 (patch)
tree48f13acdcbd661f9aaf2c94354942cd184ca501b /imap
parentc97fcf569fc8e3ee773fa3e2bcdad09b97656a57 (diff)
add open_new_msg operation to struct mx_ops
The code was already using a function pointer to do this operation. This commit moves this function pointer to the mx_ops structure and the open_new_message functions to their respective source files if it needs to.
Diffstat (limited to 'imap')
-rw-r--r--imap/imap.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/imap/imap.c b/imap/imap.c
index e9e84191..c2db3c22 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -828,6 +828,20 @@ void imap_logout (IMAP_DATA** idata)
imap_free_idata (idata);
}
+static int imap_open_new_message (MESSAGE *msg, CONTEXT *dest, HEADER *hdr)
+{
+ char tmp[_POSIX_PATH_MAX];
+
+ mutt_mktemp (tmp, sizeof (tmp));
+ if ((msg->fp = safe_fopen (tmp, "w")) == NULL)
+ {
+ mutt_perror (tmp);
+ return (-1);
+ }
+ msg->path = safe_strdup(tmp);
+ return 0;
+}
+
/* imap_set_flag: append str to flags if we currently have permission
* according to aclbit */
static void imap_set_flag (IMAP_DATA* idata, int aclbit, int flag,
@@ -2041,4 +2055,5 @@ int imap_complete(char* dest, size_t dlen, char* path) {
struct mx_ops mx_imap_ops = {
.open = imap_open_mailbox,
.close = imap_close_mailbox,
+ .open_new_msg = imap_open_new_message,
};