about summary refs log tree commit diff stats
path: root/widgets/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/widgets/account.go b/widgets/account.go
index afae1d2..431e7b8 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -65,13 +65,6 @@ func NewAccountView(conf *config.AercConfig, acct *config.AccountConfig,
 	}
 
 	go worker.Backend.Run()
-	go func() {
-		for {
-			msg := <-worker.Messages
-			msg = worker.ProcessMessage(msg)
-			view.onMessage(msg)
-		}
-	}()
 
 	worker.PostAction(&types.Configure{Config: acct}, nil)
 	worker.PostAction(&types.Connect{}, view.connected)
@@ -80,6 +73,17 @@ func NewAccountView(conf *config.AercConfig, acct *config.AccountConfig,
 	return view
 }
 
+func (acct *AccountView) Tick() bool {
+	select {
+	case msg := <-acct.worker.Messages:
+		msg = acct.worker.ProcessMessage(msg)
+		acct.onMessage(msg)
+		return true
+	default:
+		return false
+	}
+}
+
 func (acct *AccountView) AccountConfig() *config.AccountConfig {
 	return acct.acct
 }