mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-05 15:42:46 +00:00
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:
parent
9fa39263c0
commit
72285b2659
306 changed files with 2117 additions and 1934 deletions
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/gomatrixserverlib/fclient"
|
||||
"github.com/matrix-org/gomatrixserverlib/spec"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
|
@ -35,7 +36,7 @@ import (
|
|||
// MakeJoin implements the /make_join API
|
||||
func MakeJoin(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
request *fclient.FederationRequest,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
roomID, userID string,
|
||||
|
@ -124,7 +125,7 @@ func MakeJoin(
|
|||
StateKey: &userID,
|
||||
}
|
||||
content := gomatrixserverlib.MemberContent{
|
||||
Membership: gomatrixserverlib.Join,
|
||||
Membership: spec.Join,
|
||||
AuthorisedVia: authorisedVia,
|
||||
}
|
||||
if err = builder.SetContent(content); err != nil {
|
||||
|
@ -190,7 +191,7 @@ func MakeJoin(
|
|||
// nolint:gocyclo
|
||||
func SendJoin(
|
||||
httpReq *http.Request,
|
||||
request *gomatrixserverlib.FederationRequest,
|
||||
request *fclient.FederationRequest,
|
||||
cfg *config.FederationAPI,
|
||||
rsAPI api.FederationRoomserverAPI,
|
||||
keys gomatrixserverlib.JSONVerifier,
|
||||
|
@ -231,7 +232,7 @@ func SendJoin(
|
|||
// Check that the sender belongs to the server that is sending us
|
||||
// the request. By this point we've already asserted that the sender
|
||||
// and the state key are equal so we don't need to check both.
|
||||
var serverName gomatrixserverlib.ServerName
|
||||
var serverName spec.ServerName
|
||||
if _, serverName, err = gomatrixserverlib.SplitID('@', event.Sender()); err != nil {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusForbidden,
|
||||
|
@ -278,7 +279,7 @@ func SendJoin(
|
|||
JSON: jsonerror.BadJSON("missing content.membership key"),
|
||||
}
|
||||
}
|
||||
if membership != gomatrixserverlib.Join {
|
||||
if membership != spec.Join {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.BadJSON("membership must be 'join'"),
|
||||
|
@ -349,8 +350,8 @@ func SendJoin(
|
|||
continue
|
||||
}
|
||||
if membership, merr := se.Membership(); merr == nil {
|
||||
alreadyJoined = (membership == gomatrixserverlib.Join)
|
||||
isBanned = (membership == gomatrixserverlib.Ban)
|
||||
alreadyJoined = (membership == spec.Join)
|
||||
isBanned = (membership == spec.Ban)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue