From e654226e60a475cab661bc4e00d2f711cbbc64a5 Mon Sep 17 00:00:00 2001 From: ajbura Date: Wed, 16 Feb 2022 19:54:21 +0530 Subject: [PATCH] Add via param in join room function Signed-off-by: ajbura --- src/client/action/room.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/action/room.js b/src/client/action/room.js index 9849b2e..83fbfc7 100644 --- a/src/client/action/room.js +++ b/src/client/action/room.js @@ -82,12 +82,15 @@ function guessDMRoomTargetId(room, myUserId) { * * @param {string} roomId * @param {boolean} isDM + * @param {string[]} via */ -async function join(roomIdOrAlias, isDM) { +async function join(roomIdOrAlias, isDM, via) { const mx = initMatrix.matrixClient; const roomIdParts = roomIdOrAlias.split(':'); + const viaServers = via || [roomIdParts[1]]; + try { - const resultRoom = await mx.joinRoom(roomIdOrAlias, { viaServers: [roomIdParts[1]] }); + const resultRoom = await mx.joinRoom(roomIdOrAlias, { viaServers }); if (isDM) { const targetUserId = guessDMRoomTargetId(mx.getRoom(resultRoom.roomId), mx.getUserId());