aerc/worker/types/messages.go

179 lines
2.2 KiB
Go
Raw Normal View History

package types
import (
2018-02-01 03:54:52 +01:00
"crypto/x509"
2019-03-31 17:10:10 +02:00
"io"
"time"
"github.com/emersion/go-imap"
2018-02-01 03:54:52 +01:00
2019-05-18 02:57:10 +02:00
"git.sr.ht/~sircmpwn/aerc/config"
)
type WorkerMessage interface {
InResponseTo() WorkerMessage
getId() int
setId(id int)
}
type Message struct {
inResponseTo WorkerMessage
id int
}
2018-02-01 03:54:52 +01:00
func RespondTo(msg WorkerMessage) Message {
return Message{
inResponseTo: msg,
}
}
func (m Message) InResponseTo() WorkerMessage {
return m.inResponseTo
}
func (m Message) getId() int {
return m.id
}
func (m Message) setId(id int) {
m.id = id
}
// Meta-messages
2018-01-14 11:30:11 +01:00
2018-02-02 01:34:08 +01:00
type Done struct {
Message
}
type Error struct {
Message
Error error
}
type Unsupported struct {
Message
}
2018-02-01 03:54:52 +01:00
// Actions
2018-01-14 11:30:11 +01:00
2018-02-02 01:54:19 +01:00
type ApproveCertificate struct {
Message
2018-02-02 01:54:19 +01:00
Approved bool
}
type Configure struct {
Message
2018-01-11 15:04:18 +01:00
Config *config.AccountConfig
}
type Connect struct {
Message
}
type Disconnect struct {
Message
}
2018-02-02 01:34:08 +01:00
type ListDirectories struct {
Message
}
2019-01-13 22:18:10 +01:00
type OpenDirectory struct {
Message
Directory string
}
type FetchDirectoryContents struct {
Message
}
type FetchMessageHeaders struct {
Message
Uids imap.SeqSet
}
type FetchFullMessages struct {
Message
Uids imap.SeqSet
}
2019-03-31 17:10:10 +02:00
type FetchMessageBodyPart struct {
Message
Uid uint32
Part int
}
2019-03-21 04:23:38 +01:00
type DeleteMessages struct {
Message
Uids imap.SeqSet
}
2019-05-14 22:34:42 +02:00
type CopyMessages struct {
Message
Destination string
Uids imap.SeqSet
}
type AppendMessage struct {
Message
Destination string
Flags []string
Date time.Time
Reader io.Reader
Length int
}
2018-02-01 03:54:52 +01:00
// Messages
2018-02-02 01:54:19 +01:00
type CertificateApprovalRequest struct {
2018-02-02 01:34:08 +01:00
Message
2018-02-02 01:54:19 +01:00
CertPool *x509.CertPool
2018-02-02 01:34:08 +01:00
}
2018-02-02 01:54:19 +01:00
type Directory struct {
2018-02-01 03:54:52 +01:00
Message
2018-02-02 01:54:19 +01:00
Attributes []string
Name string
}
2019-01-13 22:18:10 +01:00
type DirectoryInfo struct {
Message
Flags []string
2019-01-14 01:37:06 +01:00
Name string
ReadOnly bool
2019-01-13 22:18:10 +01:00
Exists, Recent, Unseen int
}
type DirectoryContents struct {
Message
Uids []uint32
}
type MessageInfo struct {
Message
2019-03-31 17:10:10 +02:00
BodyStructure *imap.BodyStructure
Envelope *imap.Envelope
Flags []string
InternalDate time.Time
Size uint32
Uid uint32
}
2019-03-21 04:23:38 +01:00
type FullMessage struct {
2019-03-30 03:35:53 +01:00
Message
Reader io.Reader
Uid uint32
2019-03-30 03:35:53 +01:00
}
2019-03-31 17:10:10 +02:00
type MessageBodyPart struct {
Message
Reader io.Reader
2019-03-31 17:10:10 +02:00
Uid uint32
}
2019-03-21 04:23:38 +01:00
type MessagesDeleted struct {
Message
Uids []uint32
}