]> granicus.if.org Git - neomutt/commitdiff
notmuch: delegate msg_open_new to maildir backend 1547/head
authorAustin Ray <austin@austinray.io>
Thu, 24 Jan 2019 00:45:01 +0000 (19:45 -0500)
committerRichard Russon <rich@flatcap.org>
Tue, 19 Feb 2019 12:06:09 +0000 (12:06 +0000)
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

maildir/lib.h
maildir/maildir.c
notmuch/mutt_notmuch.c

index 57f3c5f1e68c38aced438c19a59b6429fee9291e..9979369421de5d06af491ae840be09ff4ee916cb 100644 (file)
@@ -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);
index 729667f5d720ab1d93fc9bbb58d07b72c5c9f85f..dc16e3acbde5ecf848322d911877aed6f69b5bf8 100644 (file)
@@ -43,6 +43,7 @@
 #include <time.h>
 #include <unistd.h>
 #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;
index 5695f3e8c882e545d650b1c546d651e8fc09748d..b72f268fb63c2a488c3e711981c2adc216028eff 100644 (file)
@@ -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,