mirror of
https://git.sr.ht/~rjarry/aerc
synced 2026-03-02 18:23:33 +01:00
imap: only restrict list-status to a single directory when we can
rjarry mentioned on IRC that my e4b38efb29
commit was a bit too brutal, and regressed check-mail (checking only the
current directory instead of all).
This patch improves it by continuing to use "" as ref for LIST-STATUS
unless CheckMail.Directories contains a single directory, in which case
it uses it as ref.
This keeps most of the performance benefits (since we usually have at
most one directory to check when navigating between folders) without
regressing in terms of functionality (in particular I've checked that
check-mail does look at and updates *all* folders, not only the current
one).
Signed-off-by: Simon Martin <simon@nasilyan.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
committed by
Robin Jarry
parent
c9a57f76bf
commit
96603ea04e
@@ -21,7 +21,12 @@ func (w *IMAPWorker) handleCheckMailMessage(msg *types.CheckMail) {
|
||||
switch {
|
||||
case w.liststatus:
|
||||
w.worker.Tracef("Checking mail with LIST-STATUS")
|
||||
statuses, err = w.client.liststatus.ListStatus(w.client.Mailbox().Name, "*", items, nil)
|
||||
ref := ""
|
||||
if len(msg.Directories) == 1 {
|
||||
// If checking a single directory, restrict the ListStatus to it.
|
||||
ref = msg.Directories[0]
|
||||
}
|
||||
statuses, err = w.client.liststatus.ListStatus(ref, "*", items, nil)
|
||||
if err != nil {
|
||||
w.worker.PostMessage(&types.Error{
|
||||
Message: types.RespondTo(msg),
|
||||
|
||||
Reference in New Issue
Block a user