reinstate federated peeks in the roomserver (doh)

This commit is contained in:
Matthew Hodgson 2020-09-12 00:23:57 +01:00
parent df29509e7e
commit 410ac724a6

View file

@ -151,11 +151,27 @@ func (r *Peeker) performPeekRoomByID(
}
}
// handle federated peeks
if domain != r.Cfg.Matrix.ServerName {
// If the server name in the room ID isn't ours then it's a
// possible candidate for finding the room via federation. Add
// it to the list of servers to try.
if domain != r.Cfg.Matrix.ServerName {
req.ServerNames = append(req.ServerNames, domain)
// Try peeking by all of the supplied server names.
fedReq := fsAPI.PerformPeekRequest{
RoomID: req.RoomIDOrAlias, // the room ID to try and peek
ServerNames: req.ServerNames, // the servers to try peeking via
}
fedRes := fsAPI.PerformPeekResponse{}
r.FSAPI.PerformPeek(ctx, &fedReq, &fedRes)
if fedRes.LastError != nil {
return "", &api.PerformError{
Code: api.PerformErrRemote,
Msg: fedRes.LastError.Message,
RemoteCode: fedRes.LastError.Code,
}
}
}
// If this room isn't world_readable, we reject.