summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-02-10 00:06:54 +0100
committerGitHub <noreply@github.com>2020-02-10 00:06:54 +0100
commit54ed6320c2cc4a9748f9faec5780603aeee3de8c (patch)
treee4fdf6173492533d44b46946dfd825d966ab2a17 /vendor/github.com/matterbridge
parent23083f3ae0ffd28ca4094c75c90ba45fc57bd523 (diff)
downloadmatterbridge-msglm-54ed6320c2cc4a9748f9faec5780603aeee3de8c.tar.gz
matterbridge-msglm-54ed6320c2cc4a9748f9faec5780603aeee3de8c.tar.bz2
matterbridge-msglm-54ed6320c2cc4a9748f9faec5780603aeee3de8c.zip
Add support for avatars from matrix. #984 (#1007)
Diffstat (limited to 'vendor/github.com/matterbridge')
-rw-r--r--vendor/github.com/matterbridge/gomatrix/client.go15
1 files changed, 15 insertions, 0 deletions
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")