about summary refs log blame commit diff stats
path: root/worker/types/messages.go
blob: e83bd6bc964f0aabbe9477fd4636a1901b0a30fa (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                          
 













                         
 





                       
                                    


















                                               
package types

import (
	"git.sr.ht/~sircmpwn/aerc2/config"
)

type WorkerMessage interface {
	InResponseTo() WorkerMessage
}

type Message struct {
	inResponseTo WorkerMessage
}

// Meta-messages

type Ack struct {
	Message
}

type Error struct {
	Message
	Error error
}

type Unsupported struct {
	Message
}

// Commands

type Ping struct {
	Message
}

type Configure struct {
	Message
	Config *config.AccountConfig
}

type Connect struct {
	Message
}

type Disconnect struct {
	Message
}

func RespondTo(msg WorkerMessage) Message {
	return Message{
		inResponseTo: msg,
	}
}

func (m Message) InResponseTo() WorkerMessage {
	return m.inResponseTo
}