diff options
author | Tulir Asokan <tulir@maunium.net> | 2019-06-16 15:18:25 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2019-06-16 15:18:25 +0300 |
commit | 8b87809ac1cae1263d3591a1b9b5b88c944034d8 (patch) | |
tree | 25c6421dc5da1b96d2d7804eccad94ed8a2ee1a1 /gomuks.go | |
parent | d3c18788dda5c2205a858c99afc75acc46c7ed33 (diff) | |
parent | 1ea6ba026aab8b9d3e66681c97043b5806ef4971 (diff) |
Merge branch 'break-things-again'
Diffstat (limited to 'gomuks.go')
-rw-r--r-- | gomuks.go | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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 @@ -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() |