refactor: update GMSL (#3058)

Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364

Read this commit by commit to avoid going insane.
This commit is contained in:
kegsay 2023-04-19 15:50:33 +01:00 committed by GitHub
parent 9fa39263c0
commit 72285b2659
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
306 changed files with 2117 additions and 1934 deletions

View file

@ -21,6 +21,8 @@ import (
"time"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/gomatrixserverlib/fclient"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
@ -30,10 +32,10 @@ import (
// GetEvent returns the requested event
func GetEvent(
ctx context.Context,
request *gomatrixserverlib.FederationRequest,
request *fclient.FederationRequest,
rsAPI api.FederationRoomserverAPI,
eventID string,
origin gomatrixserverlib.ServerName,
origin spec.ServerName,
) util.JSONResponse {
err := allowedToSeeEvent(ctx, request.Origin(), rsAPI, eventID)
if err != nil {
@ -48,7 +50,7 @@ func GetEvent(
return util.JSONResponse{Code: http.StatusOK, JSON: gomatrixserverlib.Transaction{
Origin: origin,
OriginServerTS: gomatrixserverlib.AsTimestamp(time.Now()),
OriginServerTS: spec.AsTimestamp(time.Now()),
PDUs: []json.RawMessage{
event.JSON(),
},
@ -59,7 +61,7 @@ func GetEvent(
// otherwise it returns an error response which can be sent to the client.
func allowedToSeeEvent(
ctx context.Context,
origin gomatrixserverlib.ServerName,
origin spec.ServerName,
rsAPI api.FederationRoomserverAPI,
eventID string,
) *util.JSONResponse {