From 6394e386c2a88c3b376cd422a7b7ce5ae7534984 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 9 Jan 2018 20:39:00 -0500 Subject: Initial pass on worker/UI message passing --- worker/types/messages.go | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 worker/types/messages.go (limited to 'worker/types') diff --git a/worker/types/messages.go b/worker/types/messages.go new file mode 100644 index 0000000..845bb86 --- /dev/null +++ b/worker/types/messages.go @@ -0,0 +1,55 @@ +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 +} -- cgit 1.4.1-2-gfad0