From: Austin Ray Date: Thu, 24 Jan 2019 00:45:01 +0000 (-0500) Subject: notmuch: delegate msg_open_new to maildir backend X-Git-Tag: 2019-10-25~361 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c25820edb6b1ffb28d5825be8108e3e69da6c9cc;p=neomutt notmuch: delegate msg_open_new to maildir backend Notmuch delegates several functions to the maildir backend since they are connected. This commit delegates the notmuch msg_open_new() to the maildir backend's implementation. The primary benefit is being able to delete attachments from emails. Previously, if an attachment was marked for deletion then it was impossible to exit a virtual mailbox since a write operation could not complete. This bug has been in Neomutt for a while. Fixes #673 --- diff --git a/maildir/lib.h b/maildir/lib.h index 57f3c5f1e..997936942 100644 --- a/maildir/lib.h +++ b/maildir/lib.h @@ -59,6 +59,7 @@ extern struct MxOps MxMhOps; int maildir_check_empty (const char *path); void maildir_gen_flags (char *dest, size_t destlen, struct Email *e); +int maildir_msg_open_new (struct Mailbox *m, struct Message *msg, struct Email *e); FILE * maildir_open_find_message(const char *folder, const char *msg, char **newname); void maildir_parse_flags (struct Email *e, const char *path); struct Email *maildir_parse_message (enum MailboxType magic, const char *fname, bool is_old, struct Email *e); diff --git a/maildir/maildir.c b/maildir/maildir.c index 729667f5d..dc16e3acb 100644 --- a/maildir/maildir.c +++ b/maildir/maildir.c @@ -43,6 +43,7 @@ #include #include #include "maildir_private.h" +#include "maildir/lib.h" #include "mutt/mutt.h" #include "config/lib.h" #include "email/lib.h" @@ -581,7 +582,7 @@ static int maildir_msg_open(struct Mailbox *m, struct Message *msg, int msgno) * @note This uses _almost_ the maildir file name format, * but with a {cur,new} prefix. */ -static int maildir_msg_open_new(struct Mailbox *m, struct Message *msg, struct Email *e) +int maildir_msg_open_new(struct Mailbox *m, struct Message *msg, struct Email *e) { if (!m) return -1; diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 5695f3e8c..b72f268fb 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -2542,7 +2542,7 @@ struct MxOps MxNotmuchOps = { .mbox_sync = nm_mbox_sync, .mbox_close = nm_mbox_close, .msg_open = nm_msg_open, - .msg_open_new = NULL, + .msg_open_new = maildir_msg_open_new, .msg_commit = nm_msg_commit, .msg_close = nm_msg_close, .msg_padding_size = NULL,