From a55ea42d7f5900bd5fc8fad047040c7865824f33 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 15 Jun 2019 01:11:51 +0300 Subject: Unbreak things --- gomuks.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gomuks.go') diff --git a/gomuks.go b/gomuks.go index 7c307b9..5b6ed92 100644 --- a/gomuks.go +++ b/gomuks.go @@ -81,13 +81,15 @@ func (gmx *Gomuks) StartAutosave() { // Stop stops the Matrix syncer, the tview app and the autosave goroutine, // then saves everything and calls os.Exit(0). -func (gmx *Gomuks) Stop() { +func (gmx *Gomuks) Stop(save bool) { debug.Print("Disconnecting from Matrix...") gmx.matrix.Stop() debug.Print("Cleaning up UI...") gmx.ui.Stop() gmx.stop <- true - gmx.Save() + if save { + gmx.Save() + } os.Exit(0) } @@ -102,7 +104,7 @@ func (gmx *Gomuks) Start() { signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c - gmx.Stop() + gmx.Stop(true) }() go gmx.StartAutosave() -- cgit v1.2.3 From 160b035c4d5b88516cb4d1f4e26ec2e2e0262bcc Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 15 Jun 2019 17:04:08 +0300 Subject: Unbreak more things --- gomuks.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gomuks.go') diff --git a/gomuks.go b/gomuks.go index 5b6ed92..1a8cec1 100644 --- a/gomuks.go +++ b/gomuks.go @@ -58,8 +58,6 @@ func NewGomuks(uiProvider ifc.UIProvider, configDir, cacheDir string) *Gomuks { // Save saves the active session and message history. func (gmx *Gomuks) Save() { gmx.config.SaveAll() - //debug.Print("Saving history...") - //gmx.ui.MainView().SaveAllHistory() } // StartAutosave calls Save() every minute until it receives a stop signal @@ -70,7 +68,9 @@ func (gmx *Gomuks) StartAutosave() { for { select { case <-ticker.C: - gmx.Save() + if gmx.config.AuthCache.InitialSyncDone { + gmx.Save() + } case val := <-gmx.stop: if val { return -- cgit v1.2.3