From 0ec82fbeae3231f8331091b7bb3de80ea2f2790b Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Mon, 7 Oct 2024 10:52:03 +0200 Subject: [PATCH] Add via parameter on join room requests as per MSC4156 Signed-off-by: Johannes Marbach --- clientapi/routing/joinroom.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/clientapi/routing/joinroom.go b/clientapi/routing/joinroom.go index 43331b42a..2fcea2fbe 100644 --- a/clientapi/routing/joinroom.go +++ b/clientapi/routing/joinroom.go @@ -44,9 +44,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,