From 54ed6320c2cc4a9748f9faec5780603aeee3de8c Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 10 Feb 2020 00:06:54 +0100 Subject: Add support for avatars from matrix. #984 (#1007) --- vendor/github.com/matterbridge/gomatrix/client.go | 15 +++++++++++++++ vendor/modules.txt | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'vendor') diff --git a/vendor/github.com/matterbridge/gomatrix/client.go b/vendor/github.com/matterbridge/gomatrix/client.go index 09e62d24..6dda4bc4 100644 --- a/vendor/github.com/matterbridge/gomatrix/client.go +++ b/vendor/github.com/matterbridge/gomatrix/client.go @@ -475,6 +475,21 @@ func (cli *Client) GetAvatarURL() (string, error) { return s.AvatarURL, nil } +// GetAvatarURL gets the user's avatar URL. See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-avatar-url +func (cli *Client) GetSenderAvatarURL(sender string) (string, error) { + urlPath := cli.BuildURL("profile", sender, "avatar_url") + s := struct { + AvatarURL string `json:"avatar_url"` + }{} + + err := cli.MakeRequest("GET", urlPath, nil, &s) + if err != nil { + return "", err + } + + return s.AvatarURL, nil +} + // SetAvatarURL sets the user's avatar URL. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-profile-userid-avatar-url func (cli *Client) SetAvatarURL(url string) error { urlPath := cli.BuildURL("profile", cli.UserID, "avatar_url") diff --git a/vendor/modules.txt b/vendor/modules.txt index 85b7f089..1d3a2f21 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -105,7 +105,7 @@ github.com/matterbridge/Rocket.Chat.Go.SDK/rest github.com/matterbridge/emoji # github.com/matterbridge/go-xmpp v0.0.0-20180529212104-cd19799fba91 github.com/matterbridge/go-xmpp -# github.com/matterbridge/gomatrix v0.0.0-20200209221412-326bea8d866e +# github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6 github.com/matterbridge/gomatrix # github.com/matterbridge/gozulipbot v0.0.0-20190212232658-7aa251978a18 github.com/matterbridge/gozulipbot -- cgit v1.2.3