fixed layout message response and removed redundant props

This commit is contained in:
Chad Pilkey 2017-06-29 14:32:31 -04:00
parent e9b669349e
commit 15c938e9cd
13 changed files with 68 additions and 93 deletions

View File

@ -214,9 +214,9 @@ class ReceivedJsonMsgHandlerActor(
} yield {
send(m.header.meetingId, envelope, m)
}
case GetCurrentLayoutMsg.NAME =>
case GetCurrentLayoutReqMsg.NAME =>
for {
m <- deserialize[GetCurrentLayoutMsg](jsonNode)
m <- deserialize[GetCurrentLayoutReqMsg](jsonNode)
} yield {
send(m.header.meetingId, envelope, m)
}

View File

@ -73,7 +73,7 @@ class MeetingActor(val props: DefaultProps,
with TransferUserToMeetingRequestHdlr
with UserMutedInVoiceConfEvtMsgHdlr
with UserTalkingInVoiceConfEvtMsgHdlr
with GetCurrentLayoutMsgHdlr
with GetCurrentLayoutReqMsgHdlr
with LockLayoutMsgHdlr
with BroadcastLayoutMsgHdlr {
@ -233,7 +233,7 @@ class MeetingActor(val props: DefaultProps,
case m: UserLeftVoiceConfEvtMsg => handle(m)
case m: UserMutedInVoiceConfEvtMsg => handle(m)
case m: UserTalkingInVoiceConfEvtMsg => handle(m)
case m: GetCurrentLayoutMsg => handleGetCurrentLayoutMsg(m)
case m: GetCurrentLayoutReqMsg => handleGetCurrentLayoutReqMsg(m)
case m: LockLayoutMsg => handleLockLayoutMsg(m)
case m: BroadcastLayoutMsg => handleBroadcastLayoutMsg(m)
case m: SetCurrentPresentationPubMsg => presentationApp2x.handleSetCurrentPresentationPubMsg(m)

View File

@ -19,7 +19,7 @@ trait BroadcastLayoutMsgHdlr {
val envelope = BbbCoreEnvelope(BroadcastLayoutEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(BroadcastLayoutEvtMsg.NAME, props.meetingProp.intId, msg.header.userId)
val body = BroadcastLayoutEvtMsgBody(msg.body.meetingId, props.recordProp.record, msg.body.requesterId,
val body = BroadcastLayoutEvtMsgBody(
Layouts.getCurrentLayout(),
MeetingStatus2x.getPermissions(liveMeeting.status).lockedLayout,
Layouts.getLayoutSetter(), affectedUsers)

View File

@ -1,34 +0,0 @@
package org.bigbluebutton.core2.message.handlers.layout
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.Layouts
trait GetCurrentLayoutMsgHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleGetCurrentLayoutMsg(msg: GetCurrentLayoutMsg): Unit = {
def broadcastEvent(msg: GetCurrentLayoutMsg): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, props.meetingProp.intId, msg.header.userId)
val envelope = BbbCoreEnvelope(GetCurrentLayoutEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(GetCurrentLayoutEvtMsg.NAME, props.meetingProp.intId, msg.header.userId)
val body = GetCurrentLayoutEvtMsgBody(msg.body.meetingId, props.recordProp.record, msg.body.requesterId,
Layouts.getCurrentLayout(),
MeetingStatus2x.getPermissions(liveMeeting.status).lockedLayout,
Layouts.getLayoutSetter())
val event = GetCurrentLayoutEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
}
broadcastEvent(msg)
}
}

View File

@ -0,0 +1,33 @@
package org.bigbluebutton.core2.message.handlers.layout
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.Layouts
trait GetCurrentLayoutReqMsgHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleGetCurrentLayoutReqMsg(msg: GetCurrentLayoutReqMsg): Unit = {
def broadcastEvent(msg: GetCurrentLayoutReqMsg): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, props.meetingProp.intId, msg.header.userId)
val envelope = BbbCoreEnvelope(GetCurrentLayoutRespMsg.NAME, routing)
val header = BbbClientMsgHeader(GetCurrentLayoutRespMsg.NAME, props.meetingProp.intId, msg.header.userId)
val body = GetCurrentLayoutRespMsgBody(Layouts.getCurrentLayout(),
MeetingStatus2x.getPermissions(liveMeeting.status).lockedLayout,
Layouts.getLayoutSetter())
val event = GetCurrentLayoutRespMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
}
broadcastEvent(msg)
}
}

View File

@ -22,7 +22,7 @@ trait LockLayoutMsgHdlr {
val envelope = BbbCoreEnvelope(LockLayoutEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(LockLayoutEvtMsg.NAME, props.meetingProp.intId, msg.header.userId)
val body = LockLayoutEvtMsgBody(msg.body.meetingId, props.recordProp.record, msg.body.setById, msg.body.lock, affectedUsers)
val body = LockLayoutEvtMsgBody(msg.header.userId, msg.body.lock, affectedUsers)
val event = LockLayoutEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
@ -30,19 +30,17 @@ trait LockLayoutMsgHdlr {
msg.body.layout foreach { l =>
Layouts.setCurrentLayout(l)
broadcastSyncLayout(msg.body.meetingId, msg.body.setById)
broadcastSyncLayout()
}
outGW.send(msgEvent)
}
def broadcastSyncLayout(meetingId: String, setById: String) {
def broadcastSyncLayout() {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, props.meetingProp.intId, msg.header.userId)
val envelope = BbbCoreEnvelope(BroadcastLayoutEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(BroadcastLayoutEvtMsg.NAME, props.meetingProp.intId, msg.header.userId)
val body = BroadcastLayoutEvtMsgBody(meetingId, props.recordProp.record, setById,
val body = BroadcastLayoutEvtMsgBody(
Layouts.getCurrentLayout(),
MeetingStatus2x.getPermissions(liveMeeting.status).lockedLayout,
Layouts.getLayoutSetter(), affectedUsers)

View File

@ -5,32 +5,28 @@ import org.bigbluebutton.common2.domain.UserVO
// In messages
object GetCurrentLayoutMsg { val NAME = "GetCurrentLayoutMsg" }
case class GetCurrentLayoutMsg(header: BbbClientMsgHeader, body: GetCurrentLayoutMsgBody) extends BbbCoreMsg
case class GetCurrentLayoutMsgBody(meetingId: String, requesterId: String)
object GetCurrentLayoutReqMsg { val NAME = "GetCurrentLayoutReqMsg" }
case class GetCurrentLayoutReqMsg(header: BbbClientMsgHeader, body: GetCurrentLayoutReqMsgBody) extends BbbCoreMsg
case class GetCurrentLayoutReqMsgBody()
object LockLayoutMsg { val NAME = "LockLayoutMsg" }
case class LockLayoutMsg(header: BbbClientMsgHeader, body: LockLayoutMsgBody) extends BbbCoreMsg
case class LockLayoutMsgBody(meetingId: String, setById: String, lock: Boolean, viewersOnly: Boolean,
layout: Option[String])
case class LockLayoutMsgBody(lock: Boolean, viewersOnly: Boolean, layout: Option[String])
object BroadcastLayoutMsg { val NAME = "BroadcastLayoutMsg" }
case class BroadcastLayoutMsg(header: BbbClientMsgHeader, body: BroadcastLayoutMsgBody) extends BbbCoreMsg
case class BroadcastLayoutMsgBody(meetingId: String, requesterId: String, layout: String)
case class BroadcastLayoutMsgBody(layout: String)
// Out messages
object GetCurrentLayoutEvtMsg { val NAME = "GetCurrentLayoutEvtMsg" }
case class GetCurrentLayoutEvtMsg(header: BbbClientMsgHeader, body: GetCurrentLayoutEvtMsgBody) extends BbbCoreMsg
case class GetCurrentLayoutEvtMsgBody(meetingId: String, recorded: Boolean, requesterId: String, layoutId: String,
locked: Boolean, setByUserId: String)
object GetCurrentLayoutRespMsg { val NAME = "GetCurrentLayoutRespMsg" }
case class GetCurrentLayoutRespMsg(header: BbbClientMsgHeader, body: GetCurrentLayoutRespMsgBody) extends BbbCoreMsg
case class GetCurrentLayoutRespMsgBody(layoutId: String, locked: Boolean, setByUserId: String)
object BroadcastLayoutEvtMsg { val NAME = "BroadcastLayoutEvtMsg" }
case class BroadcastLayoutEvtMsg(header: BbbClientMsgHeader, body: BroadcastLayoutEvtMsgBody) extends BbbCoreMsg
case class BroadcastLayoutEvtMsgBody(meetingId: String, recorded: Boolean, requesterId: String,
layoutId: String, locked: Boolean, setByUserId: String, applyTo: Array[UserVO])
case class BroadcastLayoutEvtMsgBody(layoutId: String, locked: Boolean, setByUserId: String, applyTo: Array[UserVO])
object LockLayoutEvtMsg { val NAME = "LockLayoutEvtMsg" }
case class LockLayoutEvtMsg(header: BbbClientMsgHeader, body: LockLayoutEvtMsgBody) extends BbbCoreMsg
case class LockLayoutEvtMsgBody(meetingId: String, recorded: Boolean, setById: String, locked: Boolean,
applyTo: Array[UserVO])
case class LockLayoutEvtMsgBody(setById: String, locked: Boolean, applyTo: Array[UserVO])

View File

@ -20,15 +20,9 @@ package org.bigbluebutton.core.connection.messages.layout {
public class BroadcastLayoutMsgBody {
public var meetingId:String;
public var requesterId:String;
public var layout:String;
public function BroadcastLayoutMsgBody(meetingId:String, requesterId:String, layout:String) {
this.meetingId = meetingId;
this.requesterId = requesterId;
public function BroadcastLayoutMsgBody(layout:String) {
this.layout = layout;
}
}

View File

@ -19,10 +19,10 @@
package org.bigbluebutton.core.connection.messages.layout {
import org.bigbluebutton.core.connection.messages.BbbCommonMsg;
public class GetCurrentLayoutMsg extends BbbCommonMsg {
public var body:GetCurrentLayoutMsgBody;
public class GetCurrentLayoutReqMsg extends BbbCommonMsg {
public var body:GetCurrentLayoutReqMsgBody;
public function GetCurrentLayoutMsg(body:GetCurrentLayoutMsgBody) {
public function GetCurrentLayoutReqMsg(body:GetCurrentLayoutReqMsgBody) {
super();
this.body = body;
}

View File

@ -18,15 +18,9 @@
*/
package org.bigbluebutton.core.connection.messages.layout {
public class GetCurrentLayoutMsgBody {
public class GetCurrentLayoutReqMsgBody {
public var meetingId:String;
public var requesterId:String;
public function GetCurrentLayoutMsgBody(meetingId:String, requesterId:String) {
this.meetingId = meetingId;
this.requesterId = requesterId;
public function GetCurrentLayoutReqMsgBody() {
}
}
}

View File

@ -20,19 +20,13 @@ package org.bigbluebutton.core.connection.messages.layout {
public class LockLayoutMsgBody {
public var meetingId:String;
public var setById:String;
public var lock:Boolean;
public var viewersOnly:Boolean;
public var layout:String;
public function LockLayoutMsgBody(meetingId:String, setById:String, lock:Boolean, viewersOnly:Boolean, layout:String) {
this.meetingId = meetingId;
this.setById = setById;
public function LockLayoutMsgBody(lock:Boolean, viewersOnly:Boolean, layout:String) {
this.lock = lock;
this.viewersOnly = viewersOnly;
this.layout = layout;

View File

@ -31,8 +31,8 @@ package org.bigbluebutton.modules.layout.services {
// trace("LAYOUT: received message " + messageName);
switch (messageName) {
case "GetCurrentLayoutEvtMsg":
handleGetCurrentLayoutEvtMsg(message);
case "GetCurrentLayoutRespMsg":
handleGetCurrentLayoutRespMsg(message);
break;
case "BroadcastLayoutEvtMsg":
handleBroadcastLayoutEvtMsg(message);
@ -50,7 +50,7 @@ package org.bigbluebutton.modules.layout.services {
}
}
private function handleGetCurrentLayoutEvtMsg(message:Object):void {
private function handleGetCurrentLayoutRespMsg(message:Object):void {
_applyFirstLayoutTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
onReceivedFirstLayout(message.body);
});

View File

@ -5,8 +5,8 @@ package org.bigbluebutton.modules.layout.services {
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.connection.messages.layout.BroadcastLayoutMsg;
import org.bigbluebutton.core.connection.messages.layout.BroadcastLayoutMsgBody;
import org.bigbluebutton.core.connection.messages.layout.GetCurrentLayoutMsg;
import org.bigbluebutton.core.connection.messages.layout.GetCurrentLayoutMsgBody;
import org.bigbluebutton.core.connection.messages.layout.GetCurrentLayoutReqMsg;
import org.bigbluebutton.core.connection.messages.layout.GetCurrentLayoutReqMsgBody;
import org.bigbluebutton.core.connection.messages.layout.LockLayoutMsg;
import org.bigbluebutton.core.connection.messages.layout.LockLayoutMsgBody;
import org.bigbluebutton.core.managers.ConnectionManager;
@ -16,8 +16,8 @@ package org.bigbluebutton.modules.layout.services {
private static const LOGGER:ILogger = getClassLogger(MessageSender);
public function getCurrentLayout():void {
var body:GetCurrentLayoutMsgBody = new GetCurrentLayoutMsgBody(UsersUtil.getInternalMeetingID(), UsersUtil.getMyUserID());
var message:GetCurrentLayoutMsg = new GetCurrentLayoutMsg(body);
var body:GetCurrentLayoutReqMsgBody = new GetCurrentLayoutReqMsgBody();
var message:GetCurrentLayoutReqMsg = new GetCurrentLayoutReqMsg(body);
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(function(result:String):void { // On successful result
@ -30,7 +30,7 @@ package org.bigbluebutton.modules.layout.services {
}
public function broadcastLayout(layout:LayoutDefinition):void {
var body:BroadcastLayoutMsgBody = new BroadcastLayoutMsgBody(UsersUtil.getInternalMeetingID(), UsersUtil.getMyUserID(), layout.toXml().toXMLString());
var body:BroadcastLayoutMsgBody = new BroadcastLayoutMsgBody(layout.toXml().toXMLString());
var message:BroadcastLayoutMsg = new BroadcastLayoutMsg(body);
var _nc:ConnectionManager = BBB.initConnectionManager();
@ -44,7 +44,7 @@ package org.bigbluebutton.modules.layout.services {
}
public function lockLayout(lock:Boolean, viewersOnly:Boolean, layout:LayoutDefinition = null):void {
var body:LockLayoutMsgBody = new LockLayoutMsgBody(UsersUtil.getInternalMeetingID(), UsersUtil.getMyUserID(), lock, viewersOnly, layout != null ? layout.toXml().toXMLString() : null);
var body:LockLayoutMsgBody = new LockLayoutMsgBody(lock, viewersOnly, layout != null ? layout.toXml().toXMLString() : null);
var message:LockLayoutMsg = new LockLayoutMsg(body);
var _nc:ConnectionManager = BBB.initConnectionManager();