Comment by ~yaymukund on ~sircmpwn/aerc2
I was able to almost fix it locally by applying the following patch:
diff --git lib/msgstore.go lib/msgstore.go index b95b68f..06c750e 100644 --- lib/msgstore.go +++ lib/msgstore.go @@ -19,6 +19,9 @@ type MessageStore struct { // Ordered list of known UIDs uids []uint32 + // Only newer uids will the invoke new email trigger + lastSeenUid uint32 + selected int bodyCallbacks map[uint32][]func(*types.FullMessage) headerCallbacks map[uint32][]func(*types.MessageInfo) @@ -196,16 +199,14 @@ func (store *MessageStore) Update(msg types.WorkerMessage) { store.Messages[msg.Info.Uid] = msg.Info } seen := false - recent := false for _, flag := range msg.Info.Flags { - if flag == models.RecentFlag { - recent = true - } else if flag == models.SeenFlag { + if flag == models.SeenFlag { seen = true } } - if !seen && recent { + if !seen && msg.Info.Uid > store.lastSeenUid { store.triggerNewEmail(msg.Info) + store.lastSeenUid = msg.Info.Uid } if _, ok := store.pendingHeaders[msg.Info.Uid]; msg.Info.Envelope != nil && ok { delete(store.pendingHeaders, msg.Info.Uid)I think you'd also want to compare against
UidValidity
and persist both values to disk for use across reboots.
Comment by ~yaymukund on ~sircmpwn/aerc2
Just want to confirm I'm experiencing this as well. If I naively remove the
recent
condition, it displays a notification for every single unread message as it's displayed. Maybe you want to keep some kind ofLAST_SEEN_TIMESTAMP
and you check the time of receipt? If that seems like an amenable approach, I'm happy to take a stab at it.Thank you for building and maintaining aerc! Really fantastic piece of software.