mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 19:51:39 +00:00
64e94e9a6f
* Implement PerformJoinRequest * Rename perform functions * Check send join response * Temporary wiring to test federation sender room joins * Actually pass through the config * Make sure membership content shows join
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package query
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/matrix-org/dendrite/federationsender/api"
|
|
"github.com/matrix-org/gomatrixserverlib"
|
|
)
|
|
|
|
// QueryJoinedHostsInRoom implements api.FederationSenderInternalAPI
|
|
func (f *FederationSenderInternalAPI) QueryJoinedHostsInRoom(
|
|
ctx context.Context,
|
|
request *api.QueryJoinedHostsInRoomRequest,
|
|
response *api.QueryJoinedHostsInRoomResponse,
|
|
) (err error) {
|
|
response.JoinedHosts, err = f.db.GetJoinedHosts(ctx, request.RoomID)
|
|
return
|
|
}
|
|
|
|
// QueryJoinedHostServerNamesInRoom implements api.FederationSenderInternalAPI
|
|
func (f *FederationSenderInternalAPI) QueryJoinedHostServerNamesInRoom(
|
|
ctx context.Context,
|
|
request *api.QueryJoinedHostServerNamesInRoomRequest,
|
|
response *api.QueryJoinedHostServerNamesInRoomResponse,
|
|
) (err error) {
|
|
joinedHosts, err := f.db.GetJoinedHosts(ctx, request.RoomID)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
response.ServerNames = make([]gomatrixserverlib.ServerName, 0, len(joinedHosts))
|
|
for _, host := range joinedHosts {
|
|
response.ServerNames = append(response.ServerNames, host.ServerName)
|
|
}
|
|
|
|
// TODO: remove duplicates?
|
|
|
|
return
|
|
}
|