summary refs log tree commit diff stats
path: root/ui
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-01-31 21:54:52 -0500
committerDrew DeVault <sir@cmpwn.com>2018-01-31 21:54:52 -0500
commit3139148c7b9ad6ed4fb9cd8cd3e4160a9b9ee46f (patch)
tree1bb500628bae5f6b64167e498b25ff09649a977c /ui
parenta21afdaa6bab8f6d05bbe9272700eef571548a59 (diff)
downloadaerc-3139148c7b9ad6ed4fb9cd8cd3e4160a9b9ee46f.tar.gz
Add certificate approval flow
Diffstat (limited to 'ui')
-rw-r--r--ui/account.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/ui/account.go b/ui/account.go
index 59544d4..0cd61c8 100644
--- a/ui/account.go
+++ b/ui/account.go
@@ -5,8 +5,6 @@ import (
 
 	tb "github.com/nsf/termbox-go"
 
-	"github.com/davecgh/go-spew/spew"
-
 	"git.sr.ht/~sircmpwn/aerc2/config"
 	"git.sr.ht/~sircmpwn/aerc2/worker"
 	"git.sr.ht/~sircmpwn/aerc2/worker/types"
@@ -64,12 +62,25 @@ func (acc *AccountTab) GetChannel() chan types.WorkerMessage {
 	return acc.Worker.GetMessages()
 }
 
+func (acc *AccountTab) postAction(msg types.WorkerMessage) {
+	acc.logger.Printf("-> %T\n", msg)
+	acc.Worker.PostAction(msg)
+}
+
 func (acc *AccountTab) HandleMessage(msg types.WorkerMessage) {
-	switch msg.InResponseTo().(type) {
-	case types.Configure:
-		// Avoid printing passwords
-		acc.logger.Printf("<- %T\n", msg)
+	acc.logger.Printf("<- %T\n", msg)
+	switch msg.(type) {
+	case types.Ack:
+		// no-op
+	case types.ApproveCertificate:
+		// TODO: Ask the user
+		acc.logger.Println("Approving certificate")
+		acc.postAction(types.Ack{
+			Message: types.RespondTo(msg),
+		})
 	default:
-		acc.logger.Printf("<- %s", spew.Sdump(msg))
+		acc.postAction(types.Unsupported{
+			Message: types.RespondTo(msg),
+		})
 	}
 }