Add via parameter on join room requests as per MSC4156

Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
This commit is contained in:
Johannes Marbach 2024-10-07 10:52:03 +02:00
parent 6cd1285ca0
commit 0ec82fbeae

View file

@ -44,9 +44,16 @@ func JoinRoomByIDOrAlias(
Content: map[string]interface{}{}, Content: map[string]interface{}{},
} }
// Check to see if any ?server_name= query parameters were // Check to see if any ?via= or ?server_name= query parameters
// given in the request. // were given in the request.
if serverNames, ok := req.URL.Query()["server_name"]; ok { if serverNames, ok := req.URL.Query()["via"]; ok {
for _, serverName := range serverNames {
joinReq.ServerNames = append(
joinReq.ServerNames,
spec.ServerName(serverName),
)
}
} else if serverNames, ok := req.URL.Query()["server_name"]; ok {
for _, serverName := range serverNames { for _, serverName := range serverNames {
joinReq.ServerNames = append( joinReq.ServerNames = append(
joinReq.ServerNames, joinReq.ServerNames,