From 3276c0d08111621401704b9d5a295675abf292bb Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sun, 14 Apr 2019 15:30:23 +0100 Subject: [PATCH] fix Mailbox->append,changed flags Replying to an email caused some unwanted side-effects: - Updating the Context left `m->changed == false` - `mutt_write_fcc()` left `m->append == true` --- maildir/maildir.c | 3 +++ maildir/mh.c | 3 +++ sendlib.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/maildir/maildir.c b/maildir/maildir.c index 7928963b2..a657093b7 100644 --- a/maildir/maildir.c +++ b/maildir/maildir.c @@ -507,7 +507,10 @@ int maildir_mbox_check(struct Mailbox *m, int *index_hint) /* Incorporate new messages */ num_new = maildir_move_to_mailbox(m, &md); if (num_new > 0) + { mutt_mailbox_changed(m, MBN_INVALID); + m->changed = true; + } mutt_buffer_pool_release(&buf); diff --git a/maildir/mh.c b/maildir/mh.c index d767878e3..bd8c0e396 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -708,7 +708,10 @@ int mh_mbox_check(struct Mailbox *m, int *index_hint) /* Incorporate new messages */ num_new = maildir_move_to_mailbox(m, &md); if (num_new > 0) + { mutt_mailbox_changed(m, MBN_INVALID); + m->changed = true; + } if (occult) return MUTT_REOPENED; diff --git a/sendlib.c b/sendlib.c index 0ee4478a5..9903ce07f 100644 --- a/sendlib.c +++ b/sendlib.c @@ -3146,6 +3146,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, mutt_folder_hook(path, NULL); #endif struct Mailbox *m_fcc = mx_path_resolve(path); + bool old_append = m_fcc->append; struct Context *ctx_fcc = mx_mbox_open(m_fcc, MUTT_APPEND | MUTT_QUIET); if (!ctx_fcc) { @@ -3333,6 +3334,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, set_noconv_flags(e->content, false); done: + m_fcc->append = old_append; #ifdef RECORD_FOLDER_HOOK /* We ran a folder hook for the destination mailbox, * now we run it for the user's current mailbox */ -- 2.40.0