From df5d9a3ec7564f0d95e3f92afc0e59588de3c4ce Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Fri, 24 Jan 2020 12:10:00 +0100 Subject: imap: emit messageinfo when changing read state. We need to emit the changed msgInfo whenever we modify the state --- worker/imap/flags.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'worker') diff --git a/worker/imap/flags.go b/worker/imap/flags.go index 57211a6..17c9393 100644 --- a/worker/imap/flags.go +++ b/worker/imap/flags.go @@ -1,6 +1,7 @@ package imap import ( + "fmt" "github.com/emersion/go-imap" "git.sr.ht/~sircmpwn/aerc/worker/types" @@ -51,12 +52,26 @@ func (imapw *IMAPWorker) handleReadMessages(msg *types.ReadMessages) { flags = []interface{}{imap.SeenFlag} } uids := toSeqSet(msg.Uids) - if err := imapw.client.UidStore(uids, item, flags, nil); err != nil { + emitErr := func(err error) { imapw.worker.PostMessage(&types.Error{ Message: types.RespondTo(msg), Error: err, }, nil) + } + if err := imapw.client.UidStore(uids, item, flags, nil); err != nil { + emitErr(err) return } - imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + imapw.worker.PostAction(&types.FetchMessageHeaders{ + Uids: msg.Uids, + }, func(_msg types.WorkerMessage) { + switch m := _msg.(type) { + case *types.Error: + err := fmt.Errorf("handleReadMessages: %v", m.Error) + imapw.worker.Logger.Printf("could not fetch headers: %s", err) + emitErr(err) + case *types.Done: + imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + } + }) } -- cgit 1.4.1-2-gfad0 a4fbd956d94'>tree commit diff stats
path: root/subx.gedit
blob: 45ef133771a4c32fa017d6d8035337aaf8fb45df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29