diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-04-18 18:35:24 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-04-18 18:35:54 +0300 |
commit | b17ff318c26aecdcf2c6719ed5b0872be5254c44 (patch) | |
tree | 43f5f9aa3ce300c15376860727ff13d3716f3751 /interface | |
parent | 3b2d5fa0349bf01217f6954813c669680cdd16d4 (diff) |
Disconnect UI from main Gomuks struct. Fixes #21
Diffstat (limited to 'interface')
-rw-r--r-- | interface/gomuks.go | 3 | ||||
-rw-r--r-- | interface/ui.go | 12 |
2 files changed, 9 insertions, 6 deletions
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) |