Bump dependencies

This commit is contained in:
Brendan Abolivier 2018-11-12 09:56:29 +00:00
parent 8b0f60a470
commit 404f064790
No known key found for this signature in database
GPG key ID: 8EF1500759F70623
2 changed files with 32 additions and 1 deletions

2
vendor/manifest vendored
View file

@ -148,7 +148,7 @@
{
"importpath": "github.com/matrix-org/gomatrixserverlib",
"repository": "https://github.com/matrix-org/gomatrixserverlib",
"revision": "677bbe93ffc9ad9ba5de615cd81185d0493f5d25",
"revision": "1c2cbc0872f0b2f19929dd70d22f77486078641e",
"branch": "master"
},
{

View file

@ -3,6 +3,7 @@ package gomatrixserverlib
import (
"context"
"net/url"
"strconv"
"golang.org/x/crypto/ed25519"
)
@ -170,3 +171,33 @@ func (ac *FederationClient) LookupRoomAlias(
err = ac.doRequest(ctx, req, &res)
return
}
// Backfill asks a homeserver for events early enough for them to not be in the
// local database.
// See https://matrix.org/docs/spec/server_server/unstable.html#get-matrix-federation-v1-backfill-roomid
func (ac *FederationClient) Backfill(
ctx context.Context, s ServerName, roomID string, limit int, eventIDs []string,
) (res Transaction, err error) {
// Encode the room ID so it won't interfer with the path.
roomID = url.PathEscape(roomID)
// Parse the limit into a string so that we can include it in the URL's query.
limitStr := strconv.Itoa(limit)
// Define the URL's query.
query := url.Values{}
query["v"] = eventIDs
query.Set("limit", limitStr)
// Use the url.URL structure to easily generate the request's URI (path?query).
u := url.URL{
Path: "/_matrix/federation/v1/backfill/" + roomID + "/",
RawQuery: query.Encode(),
}
path := u.RequestURI()
// Send the request.
req := NewFederationRequest("GET", s, path)
err = ac.doRequest(ctx, req, &res)
return
}