From 36f02e852880b88862ebe357fac3b573c6c6e76e Mon Sep 17 00:00:00 2001 From: Ghazi Triki Date: Sun, 7 Jan 2018 22:24:54 +0100 Subject: [PATCH] Request webcamsOnlyForModerator value at user enter success. --- ...GetWebcamsOnlyForModeratorReqMsgHdlr.scala | 29 +++++++++++++++++++ .../core/apps/users/UsersApp.scala | 1 + .../senders/ReceivedJsonMsgHandlerActor.scala | 2 ++ .../core/running/MeetingActor.scala | 1 + .../bigbluebutton/common2/msgs/UsersMgs.scala | 18 ++++++++++-- .../main/model/users/UserService.as | 1 + .../main/views/LockSettings.mxml | 3 +- .../modules/users/services/MessageReceiver.as | 10 +++++++ .../modules/users/services/MessageSender.as | 22 ++++++++++++++ 9 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetWebcamsOnlyForModeratorReqMsgHdlr.scala diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetWebcamsOnlyForModeratorReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetWebcamsOnlyForModeratorReqMsgHdlr.scala new file mode 100644 index 0000000000..8f626f74b9 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetWebcamsOnlyForModeratorReqMsgHdlr.scala @@ -0,0 +1,29 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter } +import org.bigbluebutton.core2.MeetingStatus2x + +trait GetWebcamsOnlyForModeratorReqMsgHdlr { + this: UsersApp => + + val liveMeeting: LiveMeeting + val outGW: OutMsgRouter + + def handleGetWebcamsOnlyForModeratorReqMsg(msg: GetWebcamsOnlyForModeratorReqMsg) { + + def buildGetWebcamsOnlyForModeratorRespMsg(meetingId: String, userId: String, webcamsOnlyForModerator: Boolean): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId) + val envelope = BbbCoreEnvelope(GetWebcamsOnlyForModeratorRespMsg.NAME, routing) + val body = GetWebcamsOnlyForModeratorRespMsgBody(webcamsOnlyForModerator, userId) + val header = BbbClientMsgHeader(GetWebcamsOnlyForModeratorRespMsg.NAME, meetingId, userId) + val event = GetWebcamsOnlyForModeratorRespMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildGetWebcamsOnlyForModeratorRespMsg(liveMeeting.props.meetingProp.intId, msg.body.requestedBy, + MeetingStatus2x.webcamsOnlyForModeratorEnabled(liveMeeting.status)) + outGW.send(event) + } +} \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala index 8c33281e29..f2c0442bb8 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala @@ -21,6 +21,7 @@ class UsersApp( with SetRecordingStatusCmdMsgHdlr with UpdateWebcamsOnlyForModeratorCmdMsgHdlr with GetRecordingStatusReqMsgHdlr + with GetWebcamsOnlyForModeratorReqMsgHdlr with AssignPresenterReqMsgHdlr with EjectUserFromMeetingCmdMsgHdlr { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index 30115db341..9a25bebf62 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -241,6 +241,8 @@ class ReceivedJsonMsgHandlerActor( routeGenericMsg[GetRecordingStatusReqMsg](envelope, jsonNode) case GetScreenshareStatusReqMsg.NAME => routeGenericMsg[GetScreenshareStatusReqMsg](envelope, jsonNode) + case GetWebcamsOnlyForModeratorReqMsg.NAME => + routeGenericMsg[GetWebcamsOnlyForModeratorReqMsg](envelope, jsonNode) case UpdateWebcamsOnlyForModeratorCmdMsg.NAME => routeGenericMsg[UpdateWebcamsOnlyForModeratorCmdMsg](envelope, jsonNode) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index 4786d3d18c..36bbb22d7f 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -204,6 +204,7 @@ class MeetingActor( state = usersApp.handleMeetingActivityResponseCmdMsg(m, state) case m: LogoutAndEndMeetingCmdMsg => usersApp.handleLogoutAndEndMeetingCmdMsg(m, state) case m: SetRecordingStatusCmdMsg => usersApp.handleSetRecordingStatusCmdMsg(m) + case m: GetWebcamsOnlyForModeratorReqMsg => usersApp.handleGetWebcamsOnlyForModeratorReqMsg(m) case m: UpdateWebcamsOnlyForModeratorCmdMsg => usersApp.handleUpdateWebcamsOnlyForModeratorCmdMsg(m) case m: GetRecordingStatusReqMsg => usersApp.handleGetRecordingStatusReqMsg(m) case m: ChangeUserEmojiCmdMsg => handleChangeUserEmojiCmdMsg(m) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala index c34705254b..9e259860f0 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala @@ -78,15 +78,13 @@ object GetRecordingStatusReqMsg { val NAME = "GetRecordingStatusReqMsg" } case class GetRecordingStatusReqMsg(header: BbbClientMsgHeader, body: GetRecordingStatusReqMsgBody) extends StandardMsg case class GetRecordingStatusReqMsgBody(requestedBy: String) - /** - * Sent by user as response to get recording mark. + * Sent to user as response to get recording mark. */ object GetRecordingStatusRespMsg { val NAME = "GetRecordingStatusRespMsg" } case class GetRecordingStatusRespMsg(header: BbbClientMsgHeader, body: GetRecordingStatusRespMsgBody) extends BbbCoreMsg case class GetRecordingStatusRespMsgBody(recording: Boolean, requestedBy: String) - /** * Sent by user to start recording mark. */ @@ -108,6 +106,20 @@ object UpdateWebcamsOnlyForModeratorCmdMsg { val NAME = "UpdateWebcamsOnlyForMod case class UpdateWebcamsOnlyForModeratorCmdMsg(header: BbbClientMsgHeader, body: UpdateWebcamsOnlyForModeratorCmdMsgBody) extends StandardMsg case class UpdateWebcamsOnlyForModeratorCmdMsgBody(webcamsOnlyForModerator: Boolean, setBy: String) +/** + * Sent by user to get the value of webcamsOnlyForModerator mark. + */ +object GetWebcamsOnlyForModeratorReqMsg { val NAME = "GetWebcamsOnlyForModeratorReqMsg" } +case class GetWebcamsOnlyForModeratorReqMsg(header: BbbClientMsgHeader, body: GetWebcamsOnlyForModeratorReqMsgBody) extends StandardMsg +case class GetWebcamsOnlyForModeratorReqMsgBody(requestedBy: String) + +/** + * Sent to user as response to get webcamsOnlyForModerator mark. + */ +object GetWebcamsOnlyForModeratorRespMsg { val NAME = "GetWebcamsOnlyForModeratorRespMsg" } +case class GetWebcamsOnlyForModeratorRespMsg(header: BbbClientMsgHeader, body: GetWebcamsOnlyForModeratorRespMsgBody) extends BbbCoreMsg +case class GetWebcamsOnlyForModeratorRespMsgBody(webcamsOnlyForModerator: Boolean, requestedBy: String) + /** * Sent to all users about webcam only for moderator value. */ diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as index 8f8e4ca4fb..4c50724ac8 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as @@ -76,6 +76,7 @@ package org.bigbluebutton.main.model.users } private function onAllowedToJoin():void { + sender.queryForWebcamsOnlyForModerator(); sender.queryForParticipants(); sender.queryForRecordingStatus(); sender.queryForGuestPolicy(); diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/LockSettings.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/LockSettings.mxml index ba64b876a6..f15cd04bba 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/LockSettings.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/LockSettings.mxml @@ -57,8 +57,7 @@ with BigBlueButton; if not, see . event.payload = lockSettings.toMap(); dispatchEvent(event); - var meetingWebcamsOnlyForModerator : Boolean = LiveMeeting.inst().meeting.webcamsOnlyForModerator; - if (meetingWebcamsOnlyForModerator != chkwebcamsOnlyForModerator.selected) { + if (LiveMeeting.inst().meeting.webcamsOnlyForModerator != chkwebcamsOnlyForModerator.selected) { var wEvent:SetWebcamsOnlyForModeratorEvent = new SetWebcamsOnlyForModeratorEvent(SetWebcamsOnlyForModeratorEvent.UPDATE_WEBCAMS_ONLY_FOR_MODERATOR); wEvent.webcamsOnlyForModerator = chkwebcamsOnlyForModerator.selected; dispatchEvent(wEvent); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageReceiver.as b/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageReceiver.as index e0d6818110..2e4ed214a8 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageReceiver.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageReceiver.as @@ -136,6 +136,9 @@ package org.bigbluebutton.modules.users.services case "GetRecordingStatusRespMsg": handleGetRecordingStatusReply(message); break; + case "GetWebcamsOnlyForModeratorRespMsg": + handleGetWebcamsOnlyForModeratorRespMsg(message); + break; case "RecordingStatusChangedEvtMsg": handleRecordingStatusChanged(message); break; @@ -609,6 +612,13 @@ package org.bigbluebutton.modules.users.services sendRecordingStatusUpdate(recording); } + + private function handleGetWebcamsOnlyForModeratorRespMsg(msg:Object):void { + var body:Object = msg.body as Object; + var webcamsOnlyForModerator: Boolean = body.webcamsOnlyForModerator as Boolean; + + LiveMeeting.inst().meeting.webcamsOnlyForModerator = webcamsOnlyForModerator; + } private function handleRecordingStatusChanged(msg: Object):void { var body:Object = msg.body as Object; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageSender.as b/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageSender.as index 8a5f93a9e1..733ea80afa 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageSender.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/users/services/MessageSender.as @@ -588,6 +588,28 @@ package org.bigbluebutton.modules.users.services JSON.stringify(message) ); } + + public function queryForWebcamsOnlyForModerator():void { + var message:Object = { + header: {name: "GetWebcamsOnlyForModeratorReqMsg", meetingId: UsersUtil.getInternalMeetingID(), + userId: UsersUtil.getMyUserID()}, + body: {requestedBy: UsersUtil.getMyUserID()} + }; + + var _nc:ConnectionManager = BBB.initConnectionManager(); + _nc.sendMessage2x( + function(result:String):void { // On successful result + LOGGER.debug(result); + }, + function(status:String):void { // status - On error occurred + var logData:Object = UsersUtil.initLogData(); + logData.tags = ["apps"]; + logData.message = "Error occured query webcamsOnlyForModerator."; + LOGGER.info(JSON.stringify(logData)); + }, + JSON.stringify(message) + ); + } public function queryForGuestPolicy():void { LOGGER.debug("queryForGuestPolicy");