From b17ff318c26aecdcf2c6719ed5b0872be5254c44 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 18 Apr 2018 18:35:24 +0300 Subject: Disconnect UI from main Gomuks struct. Fixes #21 --- interface/gomuks.go | 3 --- interface/ui.go | 12 +++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'interface') diff --git a/interface/gomuks.go b/interface/gomuks.go index fbe05e1..90a5c4c 100644 --- a/interface/gomuks.go +++ b/interface/gomuks.go @@ -18,17 +18,14 @@ package ifc import ( "maunium.net/go/gomuks/config" - "maunium.net/go/tview" ) // Gomuks is the wrapper for everything. type Gomuks interface { Matrix() MatrixContainer - App() *tview.Application UI() GomuksUI Config() *config.Config Start() Stop() - Recover() } diff --git a/interface/ui.go b/interface/ui.go index 271dbd2..731e321 100644 --- a/interface/ui.go +++ b/interface/ui.go @@ -33,11 +33,18 @@ const ( ViewMain View = "main" ) +type UIProvider func(gmx Gomuks) GomuksUI + type GomuksUI interface { Render() SetView(name View) MainView() MainView LoginView() LoginView + + Init() + Start() error + Stop() + Finish() } type MainView interface { @@ -50,8 +57,7 @@ type MainView interface { SetTyping(roomID string, users []string) ParseEvent(roomView RoomView, evt *gomatrix.Event) Message - //ProcessMessageEvent(roomView RoomView, evt *gomatrix.Event) Message - //ProcessMembershipEvent(roomView RoomView, evt *gomatrix.Event) Message + NotifyMessage(room *rooms.Room, message Message, should pushrules.PushActionArrayShould) } @@ -69,7 +75,7 @@ const ( type RoomView interface { MxRoom() *rooms.Room SaveHistory(dir string) error - LoadHistory(gmx Gomuks, dir string) (int, error) + LoadHistory(matrix MatrixContainer, dir string) (int, error) SetStatus(status string) SetTyping(users []string) -- cgit v1.2.3