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

Bug fixes#35

Open
donomii wants to merge 6 commits into
matrix-org:mainfrom
donomii:export
Open

Bug fixes#35
donomii wants to merge 6 commits into
matrix-org:mainfrom
donomii:export

Conversation

@donomii

@donomii donomii commented Jul 8, 2017

Copy link
Copy Markdown

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 added 6 commits July 8, 2017 16:11
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
@donomii

donomii commented Jul 15, 2017

Copy link
Copy Markdown
Author

Added a SendFile function, which is useful for sending files

@kegsay kegsay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better late than never..?

Comment thread responses.go
} `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
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💓

Comment thread events.go
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
Copy Markdown
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.

Comment thread client.go
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
Copy Markdown
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.

Comment thread client.go
// 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
Copy Markdown
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?

Comment thread client.go
}
defer res.Body.Close()

contents, err := ioutil.ReadAll(res.Body)

Copy link
Copy Markdown
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.

2 participants