I ran into an issue where I would read an email in my inbox that was
sent to me and cc'd a mailing list and it would not remove the 'unread'
tag after syncing the mailbox.
Apparently, when nm_synci'ing the message, the local inbox copy would be
recognized as seen but the duplicate copy in the mailing list folder
would still be in the 'new' directory, so the 'unread' flag would not
be cleared.
The way the 'duplicate' messags where handled in 'rename_filename', it
appears after the add/remove the local copy of 'msg' was not updated
with the new paths. I fixed this by destorying the message and then
re-reading it from the notmuch database.
However, the tags were still off. I had to further call
'update_header_flags' to re-read the tags from the database (using
the updated paths) to clear the 'unread' tag.
Both of these changes seem to work as expected now.
Signed-off-by: Don Zickus <dzickus(a)redhat.com>
--
I am not too familar with this code, so my changes may not be
correct. I do know they seem to work after a couple of days of
testing.
---
mutt_notmuch.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mutt_notmuch.c b/mutt_notmuch.c
index 1a39249..3a25cc1 100644
--- a/mutt_notmuch.c
+++ b/mutt_notmuch.c
@@ -1474,6 +1474,9 @@ static int rename_filename(struct nm_ctxdata *data,
notmuch_database_add_message(db, newpath, NULL);
}
}
+ notmuch_message_destroy(msg);
+ msg = NULL;
+ notmuch_database_find_message_by_filename(db, new, &msg);
st = NOTMUCH_STATUS_SUCCESS;
break;
default:
@@ -1484,6 +1487,7 @@ static int rename_filename(struct nm_ctxdata *data,
if (st == NOTMUCH_STATUS_SUCCESS && h && msg) {
notmuch_message_maildir_flags_to_tags(msg);
+ update_header_tags(h, msg);
update_tags(msg, nm_header_get_tags(h));
}
--
1.8.4