From 91529df0fecc68d5b0fdbb682529ee545884e7c5 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Wed, 3 Jul 2019 16:10:16 -0400 Subject: Factor UI models out of the worker message package Before, the information needed to display different parts of the UI was tightly coupled to the specific messages being sent back and forth to the backend worker. Separating out a models package allows us to be more specific about exactly what a backend is able to and required to provide for the UI. --- models/models.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 models/models.go (limited to 'models/models.go') diff --git a/models/models.go b/models/models.go new file mode 100644 index 0000000..00297e9 --- /dev/null +++ b/models/models.go @@ -0,0 +1,32 @@ +package models + +import ( + "io" + "time" + + "github.com/emersion/go-imap" + "github.com/emersion/go-message/mail" +) + +// A MessageInfo holds information about the structure of a message +type MessageInfo struct { + BodyStructure *imap.BodyStructure + Envelope *imap.Envelope + Flags []string + InternalDate time.Time + RFC822Headers *mail.Header + Size uint32 + Uid uint32 +} + +// A MessageBodyPart can be displayed in the message viewer +type MessageBodyPart struct { + Reader io.Reader + Uid uint32 +} + +// A FullMessage is the entire message +type FullMessage struct { + Reader io.Reader + Uid uint32 +} -- cgit v1.2.3