morpheus

A Matrix client written in Go-QT
git clone git://archive.git.mtrnord.blog/Nordgedanken/morpheus.git
Log | Files | Refs | README | LICENSE

commit 1a37dc02f9814ffe62470e8e19805575c006a80c
parent 264d2187bbc739ec9af82bd313ca138f80f4b2e3
Author: MTRNord <mtrnord1@gmail.com>
Date:   Tue, 22 Aug 2017 22:56:57 +0200

Add more Data to the localCache

Diffstat:
Mmatrix/login.go | 1-
Mmatrix/ownUser.go | 13+++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/matrix/login.go b/matrix/login.go @@ -29,7 +29,6 @@ func getClient(homeserverURL, userID, accessToken string) (*Client, error) { tx.Set("user:userID", clientInstance.UserID, nil) return nil }) - if DBerr != nil { return nil, DBerr } diff --git a/matrix/ownUser.go b/matrix/ownUser.go @@ -7,14 +7,20 @@ import ( "github.com/Nordgedanken/Neo/util" "github.com/therecipe/qt/gui" + "github.com/tidwall/buntdb" ) var localLog *log.Logger // getUserDisplayName returns the Dispaly name to a MXID func getUserDisplayName(mxid string, cli *Client) (resp *RespUserDisplayName, err error) { + urlPath := cli.BuildURL("profile", mxid, "displayname") _, err = cli.MakeRequest("GET", urlPath, nil, &resp) + err = db.Update(func(tx *buntdb.Tx) error { + tx.Set("user:displayName", resp.DisplayName, nil) + return nil + }) return } @@ -42,6 +48,13 @@ func getOwnUserAvatar(cli *Client) *gui.QPixmap { localLog.Println(err) } IMGdata = string(data[:]) + DBerr := db.Update(func(tx *buntdb.Tx) error { + tx.Set("user:avatarData100x100", IMGdata, nil) + return nil + }) + if DBerr != nil { + localLog.Fatalln(err) + } } else { IMGdata = "" }