mirror of
https://git.sr.ht/~sircmpwn/aerc
synced 2024-11-23 16:42:07 +01:00
Pull BodyStructure up from IMAP worker
This commit is contained in:
parent
5d0402aeea
commit
1f23868652
@ -1,6 +1,8 @@
|
||||
package lib
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/emersion/go-imap"
|
||||
"github.com/mohamedattahri/mail"
|
||||
|
||||
@ -91,10 +93,22 @@ func (store *MessageStore) FetchBodies(uids []uint32,
|
||||
func (store *MessageStore) merge(
|
||||
to *types.MessageInfo, from *types.MessageInfo) {
|
||||
|
||||
// TODO: Merge more shit
|
||||
if from.BodyStructure != nil {
|
||||
to.BodyStructure = from.BodyStructure
|
||||
}
|
||||
if from.Envelope != nil {
|
||||
to.Envelope = from.Envelope
|
||||
}
|
||||
if len(from.Flags) != 0 {
|
||||
to.Flags = from.Flags
|
||||
}
|
||||
if from.Size != 0 {
|
||||
to.Size = from.Size
|
||||
}
|
||||
var zero time.Time
|
||||
if from.InternalDate != zero {
|
||||
to.InternalDate = from.InternalDate
|
||||
}
|
||||
}
|
||||
|
||||
func (store *MessageStore) Update(msg types.WorkerMessage) {
|
||||
|
@ -12,6 +12,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders(
|
||||
|
||||
imapw.worker.Logger.Printf("Fetching message headers")
|
||||
items := []imap.FetchItem{
|
||||
imap.FetchBodyStructure,
|
||||
imap.FetchEnvelope,
|
||||
imap.FetchInternalDate,
|
||||
imap.FetchFlags,
|
||||
@ -57,10 +58,11 @@ func (imapw *IMAPWorker) handleFetchMessages(
|
||||
}, nil)
|
||||
} else {
|
||||
imapw.worker.PostMessage(&types.MessageInfo{
|
||||
Envelope: _msg.Envelope,
|
||||
Flags: _msg.Flags,
|
||||
InternalDate: _msg.InternalDate,
|
||||
Uid: _msg.Uid,
|
||||
BodyStructure: _msg.BodyStructure,
|
||||
Envelope: _msg.Envelope,
|
||||
Flags: _msg.Flags,
|
||||
InternalDate: _msg.InternalDate,
|
||||
Uid: _msg.Uid,
|
||||
}, nil)
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"crypto/x509"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/emersion/go-imap"
|
||||
@ -86,6 +87,12 @@ type FetchMessageBodies struct {
|
||||
Uids imap.SeqSet
|
||||
}
|
||||
|
||||
type FetchMessageBodyPart struct {
|
||||
Message
|
||||
Uid uint32
|
||||
Part int
|
||||
}
|
||||
|
||||
type DeleteMessages struct {
|
||||
Message
|
||||
Uids imap.SeqSet
|
||||
@ -120,11 +127,12 @@ type DirectoryContents struct {
|
||||
|
||||
type MessageInfo struct {
|
||||
Message
|
||||
Envelope *imap.Envelope
|
||||
Flags []string
|
||||
InternalDate time.Time
|
||||
Size uint32
|
||||
Uid uint32
|
||||
BodyStructure *imap.BodyStructure
|
||||
Envelope *imap.Envelope
|
||||
Flags []string
|
||||
InternalDate time.Time
|
||||
Size uint32
|
||||
Uid uint32
|
||||
}
|
||||
|
||||
type MessageBody struct {
|
||||
@ -133,6 +141,12 @@ type MessageBody struct {
|
||||
Uid uint32
|
||||
}
|
||||
|
||||
type MessageBodyPart struct {
|
||||
Message
|
||||
Reader *io.Reader
|
||||
Uid uint32
|
||||
}
|
||||
|
||||
type MessagesDeleted struct {
|
||||
Message
|
||||
Uids []uint32
|
||||
|
Loading…
Reference in New Issue
Block a user