diff options
author | Koni Marti <koni.marti@gmail.com> | 2022-08-08 22:21:45 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2022-08-22 09:30:37 +0200 |
commit | 117f99e187e16086c1c43a03d640da3294e9e730 (patch) | |
tree | 7cec6d937e31fea03d6244f97eba944ac44e5c40 /lib/msgstore.go | |
parent | b12dd9f9263f7c2cf2f91bc3f6f5549ee0165cb1 (diff) | |
download | aerc-117f99e187e16086c1c43a03d640da3294e9e730.tar.gz |
mark: (un)mark message threads
Mark or unmark the shown message threads. Threads must be available in the
message store. Use the -T option for the mark or unmark commands. Can be
used in combination with the toggle flag (-t).
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/msgstore.go')
-rw-r--r-- | lib/msgstore.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go index d126fee8..d47c14fc 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -411,6 +411,28 @@ func (store *MessageStore) runThreadBuilder() { }) } +// SelectedThread returns the thread with the UID from the selected message +func (store *MessageStore) SelectedThread() *types.Thread { + var thread *types.Thread + for _, root := range store.Threads() { + found := false + err := root.Walk(func(t *types.Thread, _ int, _ error) error { + if t.Uid == store.SelectedUid() { + thread = t + found = true + } + return nil + }) + if err != nil { + logging.Errorf("SelectedThread failed: %w", err) + } + if found { + break + } + } + return thread +} + func (store *MessageStore) Delete(uids []uint32, cb func(msg types.WorkerMessage), ) { |