2019-03-15 02:19:04 +00:00
|
|
|
package imap
|
|
|
|
|
|
|
|
import (
|
2019-06-07 08:26:14 +00:00
|
|
|
"bufio"
|
2020-01-04 20:13:52 +00:00
|
|
|
"fmt"
|
2019-06-07 08:26:14 +00:00
|
|
|
|
2019-03-15 02:19:04 +00:00
|
|
|
"github.com/emersion/go-imap"
|
2019-06-07 08:26:14 +00:00
|
|
|
"github.com/emersion/go-message"
|
2020-01-04 20:13:52 +00:00
|
|
|
_ "github.com/emersion/go-message/charset"
|
2019-06-07 08:26:14 +00:00
|
|
|
"github.com/emersion/go-message/mail"
|
|
|
|
"github.com/emersion/go-message/textproto"
|
2019-03-15 02:19:04 +00:00
|
|
|
|
2022-03-22 08:52:27 +00:00
|
|
|
"git.sr.ht/~rjarry/aerc/logging"
|
2021-11-05 09:19:46 +00:00
|
|
|
"git.sr.ht/~rjarry/aerc/models"
|
|
|
|
"git.sr.ht/~rjarry/aerc/worker/types"
|
2019-03-15 02:19:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (imapw *IMAPWorker) handleFetchMessageHeaders(
|
|
|
|
msg *types.FetchMessageHeaders) {
|
imap: add option to cache headers
Add option to cache headers for imap accounts. Cache db is located at
$XDG_CACHE_DIR/aerc/{account name}. The cache is cleaned of stale
entries when aerc is first opened.
Two new account level configuration options are introduced:
* cache-headers (Default: false)
* cache-max-age (Default: 30 days (720 hours))
The change in worker/imap/open.go is to set the selected directory. This
is required to access the UIDVALIDITY field, which is used in
combination with the message ID to form the key for use in the cache db.
The key structure is: "header.{UIDVALIDITY}.{UID}"
Where reasonable, cache does not stop aerc from running. In general, if
there is an error in the cache, aerc should continue working as usual.
Errors are either displayed to the user or logged.
All messages are stored without flags, and when retrieved have the flags
set to SEEN. This is to prevent UI flashes. A new method to
FetchMessageFlags is introduced to update flags of cached headers. This
is done asynchronously, and the user will see their messages appear and
then any flags updated. The message will initially show as SEEN, but
will update to unread. I considered updating the cache with the
last-known flag state, however it seems prudent to spare the R/W cycle
and assume that - eventually - all messages will end up read, and if it
isn't the update will occur rather quickly.
Note that leveldb puts a lock on the database, preventing multiple
instances of aerc from accessing the cache at the same time.
Much of this work is based on previous efforts by Vladimír Magyar.
Implements: https://todo.sr.ht/~rjarry/aerc/2
Thanks: Vladimír Magyar <vladimir@mgyar.me>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: inwit <inwit@sindominio.net>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-15 12:23:51 +00:00
|
|
|
toFetch := msg.Uids
|
|
|
|
if imapw.config.cacheEnabled && imapw.cache != nil {
|
|
|
|
toFetch = imapw.getCachedHeaders(msg)
|
|
|
|
}
|
|
|
|
if len(toFetch) == 0 {
|
|
|
|
imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)},
|
|
|
|
nil)
|
|
|
|
return
|
|
|
|
}
|
2019-03-15 02:19:04 +00:00
|
|
|
imapw.worker.Logger.Printf("Fetching message headers")
|
2019-06-07 08:26:14 +00:00
|
|
|
section := &imap.BodySectionName{
|
|
|
|
BodyPartName: imap.BodyPartName{
|
|
|
|
Specifier: imap.HeaderSpecifier,
|
|
|
|
},
|
2019-06-08 05:22:41 +00:00
|
|
|
Peek: true,
|
2019-06-07 08:26:14 +00:00
|
|
|
}
|
|
|
|
|
2019-03-30 02:35:53 +00:00
|
|
|
items := []imap.FetchItem{
|
2019-03-31 15:10:10 +00:00
|
|
|
imap.FetchBodyStructure,
|
2019-03-30 02:35:53 +00:00
|
|
|
imap.FetchEnvelope,
|
|
|
|
imap.FetchInternalDate,
|
|
|
|
imap.FetchFlags,
|
|
|
|
imap.FetchUid,
|
2019-06-07 08:26:14 +00:00
|
|
|
section.FetchItem(),
|
2019-03-30 02:35:53 +00:00
|
|
|
}
|
imap: add option to cache headers
Add option to cache headers for imap accounts. Cache db is located at
$XDG_CACHE_DIR/aerc/{account name}. The cache is cleaned of stale
entries when aerc is first opened.
Two new account level configuration options are introduced:
* cache-headers (Default: false)
* cache-max-age (Default: 30 days (720 hours))
The change in worker/imap/open.go is to set the selected directory. This
is required to access the UIDVALIDITY field, which is used in
combination with the message ID to form the key for use in the cache db.
The key structure is: "header.{UIDVALIDITY}.{UID}"
Where reasonable, cache does not stop aerc from running. In general, if
there is an error in the cache, aerc should continue working as usual.
Errors are either displayed to the user or logged.
All messages are stored without flags, and when retrieved have the flags
set to SEEN. This is to prevent UI flashes. A new method to
FetchMessageFlags is introduced to update flags of cached headers. This
is done asynchronously, and the user will see their messages appear and
then any flags updated. The message will initially show as SEEN, but
will update to unread. I considered updating the cache with the
last-known flag state, however it seems prudent to spare the R/W cycle
and assume that - eventually - all messages will end up read, and if it
isn't the update will occur rather quickly.
Note that leveldb puts a lock on the database, preventing multiple
instances of aerc from accessing the cache at the same time.
Much of this work is based on previous efforts by Vladimír Magyar.
Implements: https://todo.sr.ht/~rjarry/aerc/2
Thanks: Vladimír Magyar <vladimir@mgyar.me>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: inwit <inwit@sindominio.net>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-15 12:23:51 +00:00
|
|
|
imapw.handleFetchMessages(msg, toFetch, items,
|
2020-05-16 18:03:42 +00:00
|
|
|
func(_msg *imap.Message) error {
|
|
|
|
reader := _msg.GetBody(section)
|
|
|
|
textprotoHeader, err := textproto.ReadHeader(bufio.NewReader(reader))
|
|
|
|
if err != nil {
|
2022-02-04 08:14:53 +00:00
|
|
|
imapw.worker.Logger.Printf(
|
|
|
|
"message %v: could not read header: %v", _msg.Uid, err)
|
|
|
|
imapw.worker.PostMessage(&types.Error{
|
|
|
|
Message: types.RespondTo(msg),
|
|
|
|
Error: err,
|
|
|
|
}, nil)
|
|
|
|
return nil
|
2020-05-16 18:03:42 +00:00
|
|
|
}
|
2022-03-18 08:53:02 +00:00
|
|
|
header := &mail.Header{Header: message.Header{Header: textprotoHeader}}
|
imap: add option to cache headers
Add option to cache headers for imap accounts. Cache db is located at
$XDG_CACHE_DIR/aerc/{account name}. The cache is cleaned of stale
entries when aerc is first opened.
Two new account level configuration options are introduced:
* cache-headers (Default: false)
* cache-max-age (Default: 30 days (720 hours))
The change in worker/imap/open.go is to set the selected directory. This
is required to access the UIDVALIDITY field, which is used in
combination with the message ID to form the key for use in the cache db.
The key structure is: "header.{UIDVALIDITY}.{UID}"
Where reasonable, cache does not stop aerc from running. In general, if
there is an error in the cache, aerc should continue working as usual.
Errors are either displayed to the user or logged.
All messages are stored without flags, and when retrieved have the flags
set to SEEN. This is to prevent UI flashes. A new method to
FetchMessageFlags is introduced to update flags of cached headers. This
is done asynchronously, and the user will see their messages appear and
then any flags updated. The message will initially show as SEEN, but
will update to unread. I considered updating the cache with the
last-known flag state, however it seems prudent to spare the R/W cycle
and assume that - eventually - all messages will end up read, and if it
isn't the update will occur rather quickly.
Note that leveldb puts a lock on the database, preventing multiple
instances of aerc from accessing the cache at the same time.
Much of this work is based on previous efforts by Vladimír Magyar.
Implements: https://todo.sr.ht/~rjarry/aerc/2
Thanks: Vladimír Magyar <vladimir@mgyar.me>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: inwit <inwit@sindominio.net>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-15 12:23:51 +00:00
|
|
|
info := &models.MessageInfo{
|
|
|
|
BodyStructure: translateBodyStructure(_msg.BodyStructure),
|
|
|
|
Envelope: translateEnvelope(_msg.Envelope),
|
|
|
|
Flags: translateImapFlags(_msg.Flags),
|
|
|
|
InternalDate: _msg.InternalDate,
|
|
|
|
RFC822Headers: header,
|
|
|
|
Uid: _msg.Uid,
|
|
|
|
}
|
2020-05-16 18:03:42 +00:00
|
|
|
imapw.worker.PostMessage(&types.MessageInfo{
|
|
|
|
Message: types.RespondTo(msg),
|
imap: add option to cache headers
Add option to cache headers for imap accounts. Cache db is located at
$XDG_CACHE_DIR/aerc/{account name}. The cache is cleaned of stale
entries when aerc is first opened.
Two new account level configuration options are introduced:
* cache-headers (Default: false)
* cache-max-age (Default: 30 days (720 hours))
The change in worker/imap/open.go is to set the selected directory. This
is required to access the UIDVALIDITY field, which is used in
combination with the message ID to form the key for use in the cache db.
The key structure is: "header.{UIDVALIDITY}.{UID}"
Where reasonable, cache does not stop aerc from running. In general, if
there is an error in the cache, aerc should continue working as usual.
Errors are either displayed to the user or logged.
All messages are stored without flags, and when retrieved have the flags
set to SEEN. This is to prevent UI flashes. A new method to
FetchMessageFlags is introduced to update flags of cached headers. This
is done asynchronously, and the user will see their messages appear and
then any flags updated. The message will initially show as SEEN, but
will update to unread. I considered updating the cache with the
last-known flag state, however it seems prudent to spare the R/W cycle
and assume that - eventually - all messages will end up read, and if it
isn't the update will occur rather quickly.
Note that leveldb puts a lock on the database, preventing multiple
instances of aerc from accessing the cache at the same time.
Much of this work is based on previous efforts by Vladimír Magyar.
Implements: https://todo.sr.ht/~rjarry/aerc/2
Thanks: Vladimír Magyar <vladimir@mgyar.me>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: inwit <inwit@sindominio.net>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-15 12:23:51 +00:00
|
|
|
Info: info,
|
2020-05-16 18:03:42 +00:00
|
|
|
}, nil)
|
imap: add option to cache headers
Add option to cache headers for imap accounts. Cache db is located at
$XDG_CACHE_DIR/aerc/{account name}. The cache is cleaned of stale
entries when aerc is first opened.
Two new account level configuration options are introduced:
* cache-headers (Default: false)
* cache-max-age (Default: 30 days (720 hours))
The change in worker/imap/open.go is to set the selected directory. This
is required to access the UIDVALIDITY field, which is used in
combination with the message ID to form the key for use in the cache db.
The key structure is: "header.{UIDVALIDITY}.{UID}"
Where reasonable, cache does not stop aerc from running. In general, if
there is an error in the cache, aerc should continue working as usual.
Errors are either displayed to the user or logged.
All messages are stored without flags, and when retrieved have the flags
set to SEEN. This is to prevent UI flashes. A new method to
FetchMessageFlags is introduced to update flags of cached headers. This
is done asynchronously, and the user will see their messages appear and
then any flags updated. The message will initially show as SEEN, but
will update to unread. I considered updating the cache with the
last-known flag state, however it seems prudent to spare the R/W cycle
and assume that - eventually - all messages will end up read, and if it
isn't the update will occur rather quickly.
Note that leveldb puts a lock on the database, preventing multiple
instances of aerc from accessing the cache at the same time.
Much of this work is based on previous efforts by Vladimír Magyar.
Implements: https://todo.sr.ht/~rjarry/aerc/2
Thanks: Vladimír Magyar <vladimir@mgyar.me>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: inwit <inwit@sindominio.net>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-15 12:23:51 +00:00
|
|
|
if imapw.config.cacheEnabled && imapw.cache != nil {
|
|
|
|
imapw.cacheHeader(info)
|
|
|
|
}
|
2020-05-16 18:03:42 +00:00
|
|
|
return nil
|
|
|
|
})
|
2019-03-30 02:35:53 +00:00
|
|
|
}
|
|
|
|
|
2019-03-31 16:14:37 +00:00
|
|
|
func (imapw *IMAPWorker) handleFetchMessageBodyPart(
|
|
|
|
msg *types.FetchMessageBodyPart) {
|
|
|
|
|
|
|
|
imapw.worker.Logger.Printf("Fetching message part")
|
2020-05-16 18:03:42 +00:00
|
|
|
|
|
|
|
var partHeaderSection imap.BodySectionName
|
|
|
|
partHeaderSection.Peek = true
|
|
|
|
if len(msg.Part) > 0 {
|
|
|
|
partHeaderSection.Specifier = imap.MIMESpecifier
|
|
|
|
} else {
|
|
|
|
partHeaderSection.Specifier = imap.HeaderSpecifier
|
|
|
|
}
|
|
|
|
partHeaderSection.Path = msg.Part
|
|
|
|
|
|
|
|
var partBodySection imap.BodySectionName
|
|
|
|
if len(msg.Part) > 0 {
|
|
|
|
partBodySection.Specifier = imap.EntireSpecifier
|
|
|
|
} else {
|
|
|
|
partBodySection.Specifier = imap.TextSpecifier
|
|
|
|
}
|
|
|
|
partBodySection.Path = msg.Part
|
|
|
|
|
2019-06-09 18:55:04 +00:00
|
|
|
items := []imap.FetchItem{
|
2020-05-16 18:03:42 +00:00
|
|
|
imap.FetchEnvelope,
|
2019-06-09 18:55:04 +00:00
|
|
|
imap.FetchUid,
|
2020-05-16 18:03:42 +00:00
|
|
|
imap.FetchBodyStructure,
|
|
|
|
imap.FetchFlags,
|
|
|
|
partHeaderSection.FetchItem(),
|
|
|
|
partBodySection.FetchItem(),
|
2019-06-09 18:55:04 +00:00
|
|
|
}
|
2020-05-16 18:03:42 +00:00
|
|
|
imapw.handleFetchMessages(msg, []uint32{msg.Uid}, items,
|
|
|
|
func(_msg *imap.Message) error {
|
2022-04-28 07:39:47 +00:00
|
|
|
if len(_msg.Body) == 0 {
|
|
|
|
// ignore duplicate messages with only flag updates
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
body := _msg.GetBody(&partHeaderSection)
|
|
|
|
if body == nil {
|
|
|
|
return fmt.Errorf("failed to find part: %v", partHeaderSection)
|
|
|
|
}
|
|
|
|
h, err := textproto.ReadHeader(bufio.NewReader(body))
|
2020-05-16 18:03:42 +00:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to read part header: %v", err)
|
|
|
|
}
|
|
|
|
|
2022-03-18 08:53:02 +00:00
|
|
|
part, err := message.New(message.Header{Header: h},
|
2020-05-16 18:03:42 +00:00
|
|
|
_msg.GetBody(&partBodySection))
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to create message reader: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
imapw.worker.PostMessage(&types.MessageBodyPart{
|
|
|
|
Message: types.RespondTo(msg),
|
|
|
|
Part: &models.MessageBodyPart{
|
|
|
|
Reader: part.Body,
|
|
|
|
Uid: _msg.Uid,
|
|
|
|
},
|
|
|
|
}, nil)
|
|
|
|
// Update flags (to mark message as read)
|
|
|
|
imapw.worker.PostMessage(&types.MessageInfo{
|
|
|
|
Message: types.RespondTo(msg),
|
|
|
|
Info: &models.MessageInfo{
|
|
|
|
Flags: translateImapFlags(_msg.Flags),
|
|
|
|
Uid: _msg.Uid,
|
|
|
|
},
|
|
|
|
}, nil)
|
|
|
|
return nil
|
|
|
|
})
|
2019-03-31 16:14:37 +00:00
|
|
|
}
|
|
|
|
|
2019-03-31 16:17:57 +00:00
|
|
|
func (imapw *IMAPWorker) handleFetchFullMessages(
|
|
|
|
msg *types.FetchFullMessages) {
|
|
|
|
|
|
|
|
imapw.worker.Logger.Printf("Fetching full messages")
|
|
|
|
section := &imap.BodySectionName{}
|
2019-06-09 18:55:04 +00:00
|
|
|
items := []imap.FetchItem{
|
2020-01-18 23:59:20 +00:00
|
|
|
imap.FetchEnvelope,
|
2019-06-09 18:55:04 +00:00
|
|
|
imap.FetchFlags,
|
|
|
|
imap.FetchUid,
|
|
|
|
section.FetchItem(),
|
|
|
|
}
|
2020-05-16 18:03:42 +00:00
|
|
|
imapw.handleFetchMessages(msg, msg.Uids, items,
|
|
|
|
func(_msg *imap.Message) error {
|
|
|
|
r := _msg.GetBody(section)
|
|
|
|
if r == nil {
|
|
|
|
return fmt.Errorf("could not get section %#v", section)
|
|
|
|
}
|
|
|
|
imapw.worker.PostMessage(&types.FullMessage{
|
|
|
|
Message: types.RespondTo(msg),
|
|
|
|
Content: &models.FullMessage{
|
|
|
|
Reader: bufio.NewReader(r),
|
|
|
|
Uid: _msg.Uid,
|
|
|
|
},
|
|
|
|
}, nil)
|
|
|
|
// Update flags (to mark message as read)
|
|
|
|
imapw.worker.PostMessage(&types.MessageInfo{
|
|
|
|
Message: types.RespondTo(msg),
|
|
|
|
Info: &models.MessageInfo{
|
|
|
|
Flags: translateImapFlags(_msg.Flags),
|
imap: add option to cache headers
Add option to cache headers for imap accounts. Cache db is located at
$XDG_CACHE_DIR/aerc/{account name}. The cache is cleaned of stale
entries when aerc is first opened.
Two new account level configuration options are introduced:
* cache-headers (Default: false)
* cache-max-age (Default: 30 days (720 hours))
The change in worker/imap/open.go is to set the selected directory. This
is required to access the UIDVALIDITY field, which is used in
combination with the message ID to form the key for use in the cache db.
The key structure is: "header.{UIDVALIDITY}.{UID}"
Where reasonable, cache does not stop aerc from running. In general, if
there is an error in the cache, aerc should continue working as usual.
Errors are either displayed to the user or logged.
All messages are stored without flags, and when retrieved have the flags
set to SEEN. This is to prevent UI flashes. A new method to
FetchMessageFlags is introduced to update flags of cached headers. This
is done asynchronously, and the user will see their messages appear and
then any flags updated. The message will initially show as SEEN, but
will update to unread. I considered updating the cache with the
last-known flag state, however it seems prudent to spare the R/W cycle
and assume that - eventually - all messages will end up read, and if it
isn't the update will occur rather quickly.
Note that leveldb puts a lock on the database, preventing multiple
instances of aerc from accessing the cache at the same time.
Much of this work is based on previous efforts by Vladimír Magyar.
Implements: https://todo.sr.ht/~rjarry/aerc/2
Thanks: Vladimír Magyar <vladimir@mgyar.me>
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Tested-by: inwit <inwit@sindominio.net>
Reviewed-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-06-15 12:23:51 +00:00
|
|
|
Uid: _msg.Uid,
|
|
|
|
},
|
|
|
|
}, nil)
|
|
|
|
return nil
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func (imapw *IMAPWorker) handleFetchMessageFlags(msg *types.FetchMessageFlags) {
|
|
|
|
items := []imap.FetchItem{
|
|
|
|
imap.FetchFlags,
|
|
|
|
imap.FetchUid,
|
|
|
|
}
|
|
|
|
imapw.handleFetchMessages(msg, msg.Uids, items,
|
|
|
|
func(_msg *imap.Message) error {
|
|
|
|
imapw.worker.PostMessage(&types.MessageInfo{
|
|
|
|
Message: types.RespondTo(msg),
|
|
|
|
Info: &models.MessageInfo{
|
|
|
|
Flags: translateImapFlags(_msg.Flags),
|
2020-05-16 18:03:42 +00:00
|
|
|
Uid: _msg.Uid,
|
|
|
|
},
|
|
|
|
}, nil)
|
|
|
|
return nil
|
|
|
|
})
|
2019-03-31 16:17:57 +00:00
|
|
|
}
|
|
|
|
|
2019-03-30 02:35:53 +00:00
|
|
|
func (imapw *IMAPWorker) handleFetchMessages(
|
2019-07-08 02:43:57 +00:00
|
|
|
msg types.WorkerMessage, uids []uint32, items []imap.FetchItem,
|
2020-05-16 18:03:42 +00:00
|
|
|
procFunc func(*imap.Message) error) {
|
2019-03-15 02:19:04 +00:00
|
|
|
|
2019-04-28 13:01:56 +00:00
|
|
|
messages := make(chan *imap.Message)
|
2020-01-04 20:13:52 +00:00
|
|
|
done := make(chan error)
|
2019-04-28 13:01:56 +00:00
|
|
|
|
2019-03-15 02:19:04 +00:00
|
|
|
go func() {
|
2022-03-22 08:52:27 +00:00
|
|
|
defer logging.PanicHandler()
|
|
|
|
|
2020-05-16 18:03:42 +00:00
|
|
|
var reterr error
|
2019-04-28 13:01:56 +00:00
|
|
|
for _msg := range messages {
|
2022-06-20 19:49:05 +00:00
|
|
|
imapw.seqMap.Put(_msg.SeqNum, _msg.Uid)
|
2020-05-16 18:03:42 +00:00
|
|
|
err := procFunc(_msg)
|
|
|
|
if err != nil {
|
|
|
|
if reterr == nil {
|
|
|
|
reterr = err
|
2019-06-07 08:26:14 +00:00
|
|
|
}
|
2020-05-16 18:03:42 +00:00
|
|
|
// drain the channel upon error
|
|
|
|
for range messages {
|
2020-01-04 20:13:52 +00:00
|
|
|
}
|
2019-03-15 02:19:04 +00:00
|
|
|
}
|
2019-04-28 13:01:56 +00:00
|
|
|
}
|
2020-05-16 18:03:42 +00:00
|
|
|
done <- reterr
|
2019-03-15 02:19:04 +00:00
|
|
|
}()
|
2019-04-28 13:01:56 +00:00
|
|
|
|
2020-01-04 20:13:52 +00:00
|
|
|
emitErr := func(err error) {
|
2019-04-28 13:01:56 +00:00
|
|
|
imapw.worker.PostMessage(&types.Error{
|
|
|
|
Message: types.RespondTo(msg),
|
|
|
|
Error: err,
|
|
|
|
}, nil)
|
|
|
|
}
|
2020-01-04 20:13:52 +00:00
|
|
|
|
|
|
|
set := toSeqSet(uids)
|
|
|
|
if err := imapw.client.UidFetch(set, items, messages); err != nil {
|
|
|
|
emitErr(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if err := <-done; err != nil {
|
|
|
|
emitErr(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
imapw.worker.PostMessage(
|
2022-03-18 08:53:02 +00:00
|
|
|
&types.Done{Message: types.RespondTo(msg)}, nil)
|
2020-01-04 20:13:52 +00:00
|
|
|
}
|