mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-28 16:08:27 +00:00
add server_name param
This commit is contained in:
parent
cfa0be544d
commit
9b79f9a883
1 changed files with 13 additions and 2 deletions
|
@ -33,6 +33,17 @@ func PeekRoomByIDOrAlias(
|
||||||
accountDB accounts.Database,
|
accountDB accounts.Database,
|
||||||
roomIDOrAlias string,
|
roomIDOrAlias string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
|
// Check to see if any ?server_name= query parameters were
|
||||||
|
// given in the request.
|
||||||
|
if serverNames, ok := req.URL.Query()["server_name"]; ok {
|
||||||
|
for _, serverName := range serverNames {
|
||||||
|
peekReq.ServerNames = append(
|
||||||
|
peekReq.ServerNames,
|
||||||
|
gomatrixserverlib.ServerName(serverName),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if this is a remote roomIDOrAlias, we have to ask the roomserver (or federation sender?) to
|
// if this is a remote roomIDOrAlias, we have to ask the roomserver (or federation sender?) to
|
||||||
// to call /peek and /state on the remote server.
|
// to call /peek and /state on the remote server.
|
||||||
// TODO: in future we could skip this if we know we're already participating in the room,
|
// TODO: in future we could skip this if we know we're already participating in the room,
|
||||||
|
@ -46,7 +57,7 @@ func PeekRoomByIDOrAlias(
|
||||||
}
|
}
|
||||||
peekRes := roomserverAPI.PerformPeekResponse{}
|
peekRes := roomserverAPI.PerformPeekResponse{}
|
||||||
|
|
||||||
// Ask the roomserver to perform the join.
|
// Ask the roomserver to perform the peek.
|
||||||
rsAPI.PerformPeek(req.Context(), &peekReq, &peekRes)
|
rsAPI.PerformPeek(req.Context(), &peekReq, &peekRes)
|
||||||
if peekRes.Error != nil {
|
if peekRes.Error != nil {
|
||||||
return peekRes.Error.JSONResponse()
|
return peekRes.Error.JSONResponse()
|
||||||
|
@ -66,6 +77,6 @@ func PeekRoomByIDOrAlias(
|
||||||
// TODO: Put the response struct somewhere internal.
|
// TODO: Put the response struct somewhere internal.
|
||||||
JSON: struct {
|
JSON: struct {
|
||||||
RoomID string `json:"room_id"`
|
RoomID string `json:"room_id"`
|
||||||
}{joinRes.RoomID},
|
}{peekRes.RoomID},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue