aboutsummaryrefslogtreecommitdiff
path: root/appservice
diff options
context:
space:
mode:
Diffstat (limited to 'appservice')
-rw-r--r--appservice/account.go19
-rw-r--r--appservice/server.go3
2 files changed, 15 insertions, 7 deletions
diff --git a/appservice/account.go b/appservice/account.go
index a2b95d7..2df2930 100644
--- a/appservice/account.go
+++ b/appservice/account.go
@@ -137,7 +137,10 @@ func (a *Account) userInfoUpdatedInternal(user UserID, info *UserInfo) error {
}
if info.Avatar != nil {
- err = fmt.Errorf("Avatar: not implemented")
+ err2 := mx.ProfileAvatar(mx_user_id, info.Avatar)
+ if err2 != nil {
+ err = err2
+ }
}
return err
@@ -182,8 +185,10 @@ func (a *Account) roomInfoUpdatedInternal(roomId RoomID, author UserID, info *Ro
}
if info.Picture != nil {
- // TODO
- err = fmt.Errorf("Picture: not implemented")
+ err2 := mx.RoomAvatarAs(mx_room_id, info.Picture, as_mxid)
+ if err2 != nil {
+ err = err2
+ }
}
return err
@@ -254,8 +259,8 @@ func (a *Account) eventInternal(event *Event) error {
return err
}
- if event.Attachements != nil {
- for _, file := range event.Attachements {
+ if event.Attachments != nil {
+ for _, file := range event.Attachments {
mxfile, err := mx.UploadMedia(file)
if err != nil {
return err
@@ -270,8 +275,8 @@ func (a *Account) eventInternal(event *Event) error {
content["info"] = map[string]interface{} {
"mimetype": mxfile.Mimetype(),
"size": mxfile.Size(),
- "width": sz.Width,
- "height": sz.Height,
+ "w": sz.Width,
+ "h": sz.Height,
}
} else {
content["msgtype"] = "m.file"
diff --git a/appservice/server.go b/appservice/server.go
index 5a5cebe..d96f27c 100644
--- a/appservice/server.go
+++ b/appservice/server.go
@@ -123,6 +123,9 @@ func handleTxnEvent(e *mxlib.Event) error {
typ := e.Content["msgtype"].(string)
if typ == "m.emote" {
ev.Type = connector.EVENT_MESSAGE
+ } else if typ == "m.file" || typ == "m.image" {
+ ev.Text = ""
+ ev.Attachments = []connector.MediaObject{mx.ParseMediaInfo(e.Content)}
}
if pm_room := dbIsPmRoom(e.RoomId); pm_room != nil {