From 1f23868652a2ce0e81bddd048e3e828efaff2d69 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 31 Mar 2019 11:10:10 -0400 Subject: Pull BodyStructure up from IMAP worker --- lib/msgstore.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/msgstore.go b/lib/msgstore.go index 3c77c49..c6cd2c3 100644 --- a/lib/msgstore.go +++ b/lib/msgstore.go @@ -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) { -- cgit 1.4.1-2-gfad0