From fa04323daffb8bf783ba438065a5ce47b2994bea Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 28 Apr 2020 22:00:37 +0300 Subject: Update mautrix-go and move crypto store to XDG_DATA_HOME --- matrix/matrix.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'matrix') diff --git a/matrix/matrix.go b/matrix/matrix.go index 3d1b279..8d7595e 100644 --- a/matrix/matrix.go +++ b/matrix/matrix.go @@ -135,7 +135,7 @@ func (c *Container) InitClient() error { c.client.Logger = mxLogger{} c.client.DeviceID = c.config.DeviceID - cryptoStore, err := crypto.NewGobStore(filepath.Join(c.config.CacheDir, "crypto.gob")) + cryptoStore, err := crypto.NewGobStore(filepath.Join(c.config.DataDir, "crypto.gob")) if err != nil { return err } @@ -281,8 +281,8 @@ func (c *Container) Login(user, password string) error { // Logout revokes the access token, stops the syncer and calls the OnLogout() method of the UI. func (c *Container) Logout() { c.client.Logout() - c.config.DeleteSession() c.Stop() + c.config.DeleteSession() c.client = nil c.crypto = nil c.ui.OnLogout() @@ -300,6 +300,11 @@ func (c *Container) Stop() { debug.Print("Error closing history manager:", err) } c.history = nil + debug.Print("Flushing crypto store") + err = c.crypto.Store.Flush() + if err != nil { + debug.Print("Error flushing crypto store:", err) + } } } @@ -558,7 +563,6 @@ func (c *Container) HandleEncrypted(source EventSource, mxEvent *event.Event) { debug.Print("Failed to decrypt event:", err) return } - debug.Print("!!!!!", evt) c.HandleMessage(source, evt) } -- cgit v1.2.3