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 3ca9dae95a
commit 207e92acdd

View File

@ -36,9 +36,16 @@ func JoinRoomByIDOrAlias(
Content: map[string]interface{}{},
}
// Check to see if any ?server_name= query parameters were
// given in the request.
if serverNames, ok := req.URL.Query()["server_name"]; ok {
// Check to see if any ?via= or ?server_name= query parameters
// were given in the request.
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 {
joinReq.ServerNames = append(
joinReq.ServerNames,