Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Bug fixes #35

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Bug fixes #35

wants to merge 6 commits into from

Conversation

donomii
Copy link

@donomii donomii commented Jul 8, 2017

Two fixes

  1. Fix InviteUser, it was sending an empty request instead of the provided data
  2. "origin_server_ts" needs to be int64 or it won't compile on 32 bit machines

@donomii
Copy link
Author

donomii commented Jul 15, 2017

Added a SendFile function, which is useful for sending files

Copy link
Member

@kegsay kegsay left a 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
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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!

@kegsay kegsay mentioned this pull request May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants