Skip to content

Commit

Permalink
mutt, notmuch: Update 'unread' tag for all files mapped to msg
Browse files Browse the repository at this point in the history
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 <[email protected]>

--

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.
  • Loading branch information
dzickusrh authored and karelzak committed Dec 15, 2015
1 parent ecbdf79 commit 54058b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mutt_notmuch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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));
}

Expand Down

0 comments on commit 54058b3

Please sign in to comment.