diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2019-12-20 13:24:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-20 13:24:57 +0000 |
commit | b4d638cd04d64bf574d8af75fc22efb72b4a0798 (patch) | |
tree | cb43a24fd4cc4117b30e6bb77a120c8901a56742 /federationapi/routing/query.go | |
parent | 24ac66cffdfbc3685f03c7286e210e1bbcc40918 (diff) |
Return server names (#833)
* Remove unnecessary map->array processing
* Return server names in room federation directory query
* Knock off a TODO
Diffstat (limited to 'federationapi/routing/query.go')
-rw-r--r-- | federationapi/routing/query.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/federationapi/routing/query.go b/federationapi/routing/query.go index 781b8ea4..ed2d8b74 100644 --- a/federationapi/routing/query.go +++ b/federationapi/routing/query.go @@ -21,6 +21,7 @@ import ( "github.com/matrix-org/dendrite/clientapi/httputil" "github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/common/config" + federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api" roomserverAPI "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" @@ -33,6 +34,7 @@ func RoomAliasToID( federation *gomatrixserverlib.FederationClient, cfg config.Dendrite, aliasAPI roomserverAPI.RoomserverAliasAPI, + senderAPI federationSenderAPI.FederationSenderQueryAPI, ) util.JSONResponse { roomAlias := httpReq.FormValue("room_alias") if roomAlias == "" { @@ -59,10 +61,15 @@ func RoomAliasToID( } if queryRes.RoomID != "" { - // TODO: List servers that are aware of this room alias + serverQueryReq := federationSenderAPI.QueryJoinedHostServerNamesInRoomRequest{RoomID: queryRes.RoomID} + var serverQueryRes federationSenderAPI.QueryJoinedHostServerNamesInRoomResponse + if err = senderAPI.QueryJoinedHostServerNamesInRoom(httpReq.Context(), &serverQueryReq, &serverQueryRes); err != nil { + return httputil.LogThenError(httpReq, err) + } + resp = gomatrixserverlib.RespDirectory{ RoomID: queryRes.RoomID, - Servers: []gomatrixserverlib.ServerName{}, + Servers: serverQueryRes.ServerNames, } } else { // If no alias was found, return an error |