Skip to content

Commit

Permalink
mutt, 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 <dzickus@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.
  • Loading branch information
dzickusrh authored and flatcap committed Apr 4, 2016
1 parent c47a9aa commit 3270cf4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mutt_notmuch.c
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 3270cf4

Please sign in to comment.