2018-01-10 02:39:00 +01:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
2019-03-31 17:10:10 +02:00
|
|
|
"io"
|
2019-03-11 04:45:00 +01:00
|
|
|
"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"
|
2019-07-08 04:43:56 +02:00
|
|
|
"git.sr.ht/~sircmpwn/aerc/models"
|
2018-01-10 02:39:00 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type WorkerMessage interface {
|
|
|
|
InResponseTo() WorkerMessage
|
2019-05-19 11:50:19 +02:00
|
|
|
getId() int64
|
|
|
|
setId(id int64)
|
2018-01-10 02:39:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type Message struct {
|
|
|
|
inResponseTo WorkerMessage
|
2019-05-19 11:50:19 +02:00
|
|
|
id int64
|
2018-01-10 02:39:00 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2019-05-19 11:50:19 +02:00
|
|
|
func (m Message) getId() int64 {
|
2019-05-16 01:41:21 +02:00
|
|
|
return m.id
|
|
|
|
}
|
|
|
|
|
2019-06-02 19:20:02 +02:00
|
|
|
func (m *Message) setId(id int64) {
|
2019-05-16 01:41:21 +02:00
|
|
|
m.id = id
|
|
|
|
}
|
|
|
|
|
2018-01-10 02:39:00 +01:00
|
|
|
// Meta-messages
|
2018-01-14 11:30:11 +01:00
|
|
|
|
2018-02-02 01:34:08 +01:00
|
|
|
type Done struct {
|
|
|
|
Message
|
|
|
|
}
|
|
|
|
|
2018-01-10 02:39:00 +01:00
|
|
|
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-01-10 02:39:00 +01:00
|
|
|
type Configure struct {
|
|
|
|
Message
|
2018-01-11 15:04:18 +01:00
|
|
|
Config *config.AccountConfig
|
2018-01-10 02:39:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2019-03-11 04:45:00 +01:00
|
|
|
type FetchDirectoryContents struct {
|
|
|
|
Message
|
|
|
|
}
|
|
|
|
|
2019-06-24 22:29:13 +02:00
|
|
|
type SearchDirectory struct {
|
|
|
|
Message
|
|
|
|
Criteria *imap.SearchCriteria
|
|
|
|
}
|
|
|
|
|
2019-06-08 19:41:56 +02:00
|
|
|
type CreateDirectory struct {
|
|
|
|
Message
|
|
|
|
Directory string
|
2019-07-11 06:49:09 +02:00
|
|
|
Quiet bool
|
2019-06-08 19:41:56 +02:00
|
|
|
}
|
|
|
|
|
2019-03-11 04:45:00 +01:00
|
|
|
type FetchMessageHeaders struct {
|
|
|
|
Message
|
2019-07-08 04:43:57 +02:00
|
|
|
Uids []uint32
|
2019-03-11 04:45:00 +01:00
|
|
|
}
|
|
|
|
|
2019-03-31 18:17:57 +02:00
|
|
|
type FetchFullMessages struct {
|
2019-03-11 04:45:00 +01:00
|
|
|
Message
|
2019-07-08 04:43:57 +02:00
|
|
|
Uids []uint32
|
2019-03-11 04:45:00 +01:00
|
|
|
}
|
|
|
|
|
2019-03-31 17:10:10 +02:00
|
|
|
type FetchMessageBodyPart struct {
|
|
|
|
Message
|
|
|
|
Uid uint32
|
2019-05-20 22:42:44 +02:00
|
|
|
Part []int
|
2019-03-31 17:10:10 +02:00
|
|
|
}
|
|
|
|
|
2019-03-21 04:23:38 +01:00
|
|
|
type DeleteMessages struct {
|
|
|
|
Message
|
2019-07-08 04:43:57 +02:00
|
|
|
Uids []uint32
|
2019-03-21 04:23:38 +01:00
|
|
|
}
|
|
|
|
|
2019-06-09 20:55:34 +02:00
|
|
|
// Marks messages as read or unread
|
|
|
|
type ReadMessages struct {
|
|
|
|
Message
|
|
|
|
Read bool
|
2019-07-08 04:43:57 +02:00
|
|
|
Uids []uint32
|
2019-06-09 20:55:34 +02:00
|
|
|
}
|
|
|
|
|
2019-05-14 22:34:42 +02:00
|
|
|
type CopyMessages struct {
|
|
|
|
Message
|
|
|
|
Destination string
|
2019-07-08 04:43:57 +02:00
|
|
|
Uids []uint32
|
2019-05-14 22:34:42 +02:00
|
|
|
}
|
|
|
|
|
2019-05-16 01:41:21 +02:00
|
|
|
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-01-10 02:39:00 +01:00
|
|
|
|
2018-02-02 01:54:19 +01:00
|
|
|
type Directory struct {
|
2018-02-01 03:54:52 +01:00
|
|
|
Message
|
2019-07-08 04:43:56 +02:00
|
|
|
Dir *models.Directory
|
2018-01-10 02:39:00 +01:00
|
|
|
}
|
2019-01-13 22:18:10 +01:00
|
|
|
|
|
|
|
type DirectoryInfo struct {
|
|
|
|
Message
|
2019-07-08 04:43:56 +02:00
|
|
|
Info *models.DirectoryInfo
|
2019-01-13 22:18:10 +01:00
|
|
|
}
|
2019-03-11 04:45:00 +01:00
|
|
|
|
|
|
|
type DirectoryContents struct {
|
|
|
|
Message
|
2019-03-15 02:51:29 +01:00
|
|
|
Uids []uint32
|
2019-03-11 04:45:00 +01:00
|
|
|
}
|
|
|
|
|
2019-06-24 22:29:13 +02:00
|
|
|
type SearchResults struct {
|
|
|
|
Message
|
|
|
|
Uids []uint32
|
|
|
|
}
|
|
|
|
|
2019-03-11 04:45:00 +01:00
|
|
|
type MessageInfo struct {
|
|
|
|
Message
|
2019-07-08 04:43:56 +02:00
|
|
|
Info *models.MessageInfo
|
2019-03-11 04:45:00 +01:00
|
|
|
}
|
2019-03-21 04:23:38 +01:00
|
|
|
|
2019-03-31 18:17:57 +02:00
|
|
|
type FullMessage struct {
|
2019-03-30 03:35:53 +01:00
|
|
|
Message
|
2019-07-08 04:43:56 +02:00
|
|
|
Content *models.FullMessage
|
2019-03-30 03:35:53 +01:00
|
|
|
}
|
|
|
|
|
2019-03-31 17:10:10 +02:00
|
|
|
type MessageBodyPart struct {
|
|
|
|
Message
|
2019-07-08 04:43:56 +02:00
|
|
|
Part *models.MessageBodyPart
|
2019-03-31 17:10:10 +02:00
|
|
|
}
|
|
|
|
|
2019-03-21 04:23:38 +01:00
|
|
|
type MessagesDeleted struct {
|
|
|
|
Message
|
|
|
|
Uids []uint32
|
|
|
|
}
|