-
Notifications
You must be signed in to change notification settings - Fork 52
Bug fixes #35
base: main
Are you sure you want to change the base?
Bug fixes #35
Conversation
Call was incorrectly passing a freshly initialised, empty request rather than the request data that the caller provided
Compile was failing on 32 bit linux
|
Added a SendFile function, which is useful for sending files |
kegsay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better late than never..?
| } `json:"rooms"` | ||
| } | ||
|
|
||
| // RespTurnServer was written by someone else who later turned on the automatic commit checker so no-one could commit without writing this comment lol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💓
| Sender string `json:"sender"` // The user ID of the sender of the event | ||
| Type string `json:"type"` // The event type | ||
| Timestamp int `json:"origin_server_ts"` // The unix timestamp when this message was sent by the origin server | ||
| Timestamp int64 `json:"origin_server_ts"` // The unix timestamp when this message was sent by the origin server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another PR did this.
| func (cli *Client) InviteUser(roomID string, req *ReqInviteUser) (resp *RespInviteUser, err error) { | ||
| u := cli.BuildURL("rooms", roomID, "invite") | ||
| _, err = cli.MakeRequest("POST", u, struct{}{}, &resp) | ||
| _, err = cli.MakeRequest("POST", u, req, &resp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another PR did this.
| // Download download a mxc url. Used to get sent file/photos/etc from the matrix server | ||
| func (cli *Client) Download(url string) (string, []byte, error) { | ||
| path := strings.Replace(url, "mxc://", "", 1) | ||
| req, _ := http.NewRequest("GET", cli.BuildBaseURL("_matrix/media/r0/download/"+path), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we escape path?
| } | ||
| defer res.Body.Close() | ||
|
|
||
| contents, err := ioutil.ReadAll(res.Body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files may be large, it'd be nicer to return an io.ReadCloser!
Two fixes