aerc

Working clone of aerc-mail.org
git clone git://git.danielmoch.com/aerc.git
Log | Files | Refs | README | LICENSE

messages.go (2121B)


      1 package types
      2 
      3 import (
      4 	"io"
      5 	"time"
      6 
      7 	"github.com/emersion/go-imap"
      8 
      9 	"git.sr.ht/~sircmpwn/aerc/config"
     10 )
     11 
     12 type WorkerMessage interface {
     13 	InResponseTo() WorkerMessage
     14 	getId() int64
     15 	setId(id int64)
     16 }
     17 
     18 type Message struct {
     19 	inResponseTo WorkerMessage
     20 	id           int64
     21 }
     22 
     23 func RespondTo(msg WorkerMessage) Message {
     24 	return Message{
     25 		inResponseTo: msg,
     26 	}
     27 }
     28 
     29 func (m Message) InResponseTo() WorkerMessage {
     30 	return m.inResponseTo
     31 }
     32 
     33 func (m Message) getId() int64 {
     34 	return m.id
     35 }
     36 
     37 func (m *Message) setId(id int64) {
     38 	m.id = id
     39 }
     40 
     41 // Meta-messages
     42 
     43 type Done struct {
     44 	Message
     45 }
     46 
     47 type Error struct {
     48 	Message
     49 	Error error
     50 }
     51 
     52 type Unsupported struct {
     53 	Message
     54 }
     55 
     56 // Actions
     57 
     58 type Configure struct {
     59 	Message
     60 	Config *config.AccountConfig
     61 }
     62 
     63 type Connect struct {
     64 	Message
     65 }
     66 
     67 type Disconnect struct {
     68 	Message
     69 }
     70 
     71 type ListDirectories struct {
     72 	Message
     73 }
     74 
     75 type OpenDirectory struct {
     76 	Message
     77 	Directory string
     78 }
     79 
     80 type FetchDirectoryContents struct {
     81 	Message
     82 }
     83 
     84 type FetchMessageHeaders struct {
     85 	Message
     86 	Uids imap.SeqSet
     87 }
     88 
     89 type FetchFullMessages struct {
     90 	Message
     91 	Uids imap.SeqSet
     92 }
     93 
     94 type FetchMessageBodyPart struct {
     95 	Message
     96 	Uid  uint32
     97 	Part []int
     98 }
     99 
    100 type DeleteMessages struct {
    101 	Message
    102 	Uids imap.SeqSet
    103 }
    104 
    105 type CopyMessages struct {
    106 	Message
    107 	Destination string
    108 	Uids        imap.SeqSet
    109 }
    110 
    111 type AppendMessage struct {
    112 	Message
    113 	Destination string
    114 	Flags       []string
    115 	Date        time.Time
    116 	Reader      io.Reader
    117 	Length      int
    118 }
    119 
    120 // Messages
    121 
    122 type Directory struct {
    123 	Message
    124 	Attributes []string
    125 	Name       string
    126 }
    127 
    128 type DirectoryInfo struct {
    129 	Message
    130 	Flags    []string
    131 	Name     string
    132 	ReadOnly bool
    133 
    134 	Exists, Recent, Unseen int
    135 }
    136 
    137 type DirectoryContents struct {
    138 	Message
    139 	Uids []uint32
    140 }
    141 
    142 type MessageInfo struct {
    143 	Message
    144 	BodyStructure *imap.BodyStructure
    145 	Envelope      *imap.Envelope
    146 	Flags         []string
    147 	InternalDate  time.Time
    148 	Size          uint32
    149 	Uid           uint32
    150 }
    151 
    152 type FullMessage struct {
    153 	Message
    154 	Reader io.Reader
    155 	Uid    uint32
    156 }
    157 
    158 type MessageBodyPart struct {
    159 	Message
    160 	Reader io.Reader
    161 	Uid    uint32
    162 }
    163 
    164 type MessagesDeleted struct {
    165 	Message
    166 	Uids []uint32
    167 }