-
Notifications
You must be signed in to change notification settings - Fork 53
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 |
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..?
@@ -163,6 +163,7 @@ type RespSync struct { | |||
} `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.
💓
@@ -10,7 +10,7 @@ type Event struct { | |||
StateKey *string `json:"state_key,omitempty"` // The state key for the event. Only present on State Events. | |||
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.
@@ -515,7 +530,7 @@ func (cli *Client) ForgetRoom(roomID string) (resp *RespForgetRoom, err error) { | |||
// InviteUser invites a user to a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite | |||
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