From c056bdf1049051b9b56f646310909554aa24f932 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Thu, 16 Jul 2015 11:34:39 +0100 Subject: [PATCH] Only allow calls to be placed if there are 2 joined members. --- src/CallHandler.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/CallHandler.js b/src/CallHandler.js index 5285be1825..c041f64628 100644 --- a/src/CallHandler.js +++ b/src/CallHandler.js @@ -122,6 +122,18 @@ dis.register(function(payload) { if (calls[payload.room_id]) { return; // don't allow >1 call to be placed. } + var room = MatrixClientPeg.get().getRoom(payload.room_id); + if (!room) { + console.error("Room %s does not exist.", payload.room_id); + return; + } + if (room.getJoinedMembers().length !== 2) { + console.error( + "Fail: There are %s joined members in this room, not 2.", + room.getJoinedMembers().length + ); + return; + } console.log("Place %s call in %s", payload.type, payload.room_id); var call = Matrix.createNewMatrixCall( MatrixClientPeg.get(), payload.room_id