@@ -918,6 +918,8 @@ MatrixClient.prototype.isUserIgnored = function(userId) {
918918 * </strong> Default: true.
919919 * @param {boolean } opts.inviteSignUrl If the caller has a keypair 3pid invite,
920920 * the signing URL is passed in this parameter.
921+ * @param {string[] } opts.viaServers The server names to try and join through in
922+ * addition to those that are automatically chosen.
921923 * @param {module:client.callback } callback Optional.
922924 * @return {module:client.Promise } Resolves: Room object.
923925 * @return {module:http-api.MatrixError } Rejects: with an error response.
@@ -946,6 +948,13 @@ MatrixClient.prototype.joinRoom = function(roomIdOrAlias, opts, callback) {
946948 ) ;
947949 }
948950
951+ const queryString = { } ;
952+ if ( opts . viaServers ) {
953+ queryString [ "server_name" ] = opts . viaServers ;
954+ }
955+
956+ const reqOpts = { qsStringifyOptions : { arrayFormat : 'repeat' } } ;
957+
949958 const defer = Promise . defer ( ) ;
950959
951960 const self = this ;
@@ -956,7 +965,8 @@ MatrixClient.prototype.joinRoom = function(roomIdOrAlias, opts, callback) {
956965 }
957966
958967 const path = utils . encodeUri ( "/join/$roomid" , { $roomid : roomIdOrAlias } ) ;
959- return self . _http . authedRequest ( undefined , "POST" , path , undefined , data ) ;
968+ return self . _http . authedRequest (
969+ undefined , "POST" , path , queryString , data , reqOpts ) ;
960970 } ) . then ( function ( res ) {
961971 const roomId = res . room_id ;
962972 const syncApi = new SyncApi ( self , self . _clientOpts ) ;
0 commit comments