- put message into it's own hdlr

This commit is contained in:
Richard Alam 2017-06-13 19:26:04 -07:00
parent 91c14fae53
commit 326ba5e481
30 changed files with 429 additions and 172 deletions

View File

@ -12,8 +12,6 @@ trait UsersApp {
val outGW: OutMessageGateway
def handleValidateAuthToken(msg: ValidateAuthToken) {
log.info("Got ValidateAuthToken message. meetingId=" + msg.meetingID + " userId=" + msg.userId)
RegisteredUsers.getRegisteredUserWithToken(msg.token, msg.userId, liveMeeting.registeredUsers) match {
@ -47,107 +45,10 @@ trait UsersApp {
}
def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) {
outGW.send(new IsMeetingMutedReply(props.meetingProp.intId, props.recordProp.record,
msg.requesterID, MeetingStatus2x.isMeetingMuted(liveMeeting.status)))
}
def handleMuteUserRequest(msg: MuteUserRequest) {
log.info("Received mute user request. meetingId=" + props.meetingProp.intId + " userId=" + msg.userID + " mute=" + msg.mute)
for {
u <- Users.findWithId(msg.userID, liveMeeting.users)
} yield {
log.info("Send mute user request. meetingId=" + props.meetingProp.intId + " userId=" + u.id + " user=" + u)
outGW.send(new MuteVoiceUser(props.meetingProp.intId, props.recordProp.record,
msg.requesterID, u.id, props.voiceProp.voiceConf, u.voiceUser.userId, msg.mute))
}
}
def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) {
log.info("Received eject user request. meetingId=" + msg.meetingID + " userId=" + msg.userId)
for {
u <- Users.findWithId(msg.userId, liveMeeting.users)
} yield {
if (u.voiceUser.joined) {
log.info("Ejecting user from voice. meetingId=" + props.meetingProp.intId + " userId=" + u.id)
outGW.send(new EjectVoiceUser(props.meetingProp.intId, props.recordProp.record, msg.ejectedBy, u.id,
props.voiceProp.voiceConf, u.voiceUser.userId))
}
}
}
def handleGetLockSettings(msg: GetLockSettings) {
//println("*************** Reply with current lock settings ********************")
//reusing the existing handle for NewPermissionsSettings to reply to the GetLockSettings request
outGW.send(new NewPermissionsSetting(props.meetingProp.intId, msg.userId,
MeetingStatus2x.getPermissions(liveMeeting.status),
Users.getUsers(liveMeeting.users).toArray))
}
def handleSetLockSettings(msg: SetLockSettings) {
if (!liveMeeting.permissionsEqual(msg.settings)) {
liveMeeting.newPermissions(msg.settings)
outGW.send(new NewPermissionsSetting(props.meetingProp.intId, msg.setByUser,
MeetingStatus2x.getPermissions(liveMeeting.status),
Users.getUsers(liveMeeting.users).toArray))
handleLockLayout(msg.settings.lockedLayout, msg.setByUser)
}
}
def handleLockUserRequest(msg: LockUserRequest) {
for {
uvo <- Users.lockUser(msg.userID, msg.lock, liveMeeting.users)
} yield {
log.info("Lock user. meetingId=" + props.meetingProp.intId + " userId=" + uvo.id + " locked=" + uvo.locked)
outGW.send(new UserLocked(props.meetingProp.intId, uvo.id, uvo.locked))
}
}
def handleInitLockSettings(msg: InitLockSettings) {
if (!MeetingStatus2x.permisionsInitialized(liveMeeting.status)) {
MeetingStatus2x.initializePermissions(liveMeeting.status)
liveMeeting.newPermissions(msg.settings)
outGW.send(new PermissionsSettingInitialized(msg.meetingID, msg.settings,
Users.getUsers(liveMeeting.users).toArray))
}
}
def handleInitAudioSettings(msg: InitAudioSettings) {
if (!MeetingStatus2x.audioSettingsInitialized(liveMeeting.status)) {
MeetingStatus2x.initializeAudioSettings(liveMeeting.status)
if (MeetingStatus2x.isMeetingMuted(liveMeeting.status) != msg.muted) {
handleMuteAllExceptPresenterRequest(
new MuteAllExceptPresenterRequest(props.meetingProp.intId,
msg.requesterID, msg.muted));
}
}
}
def usersWhoAreNotPresenter(): Array[UserVO] = {
Users.usersWhoAreNotPresenter(liveMeeting.users).toArray
}
def handleUserEmojiStatus(msg: UserEmojiStatus) {
for {
uvo <- Users.setEmojiStatus(msg.userId, liveMeeting.users, msg.emojiStatus)
} yield {
outGW.send(new UserChangedEmojiStatus(props.meetingProp.intId, props.recordProp.record, msg.emojiStatus, uvo.id))
}
}
def handleChangeUserRole(msg: ChangeUserRole) {
for {
uvo <- Users.changeRole(msg.userID, liveMeeting.users, msg.role)
} yield {
RegisteredUsers.updateRegUser(uvo, liveMeeting.registeredUsers)
val userRole = if (msg.role == Roles.MODERATOR_ROLE) "MODERATOR" else "VIEWER"
outGW.send(new UserRoleChange(props.meetingProp.intId, props.recordProp.record, msg.userID, userRole))
}
}
def makeSurePresenterIsAssigned(user: UserVO): Unit = {
if (user.presenter) {
@ -178,48 +79,7 @@ trait UsersApp {
}
}
def handleEjectUserFromMeeting(msg: EjectUserFromMeeting) {
for {
user <- Users.userLeft(msg.userId, liveMeeting.users)
} yield {
if (user.voiceUser.joined) {
outGW.send(new EjectVoiceUser(props.meetingProp.intId, props.recordProp.record,
msg.ejectedBy, msg.userId, props.voiceProp.voiceConf, user.voiceUser.userId))
}
RegisteredUsers.remove(msg.userId, liveMeeting.registeredUsers)
makeSurePresenterIsAssigned(user)
log.info("Ejecting user from meeting. meetingId=" + props.meetingProp.intId + " userId=" + msg.userId)
outGW.send(new UserEjectedFromMeeting(props.meetingProp.intId, props.recordProp.record, msg.userId, msg.ejectedBy))
outGW.send(new DisconnectUser(props.meetingProp.intId, msg.userId))
outGW.send(new UserLeft(msg.meetingID, props.recordProp.record, user))
}
}
def handleUserShareWebcam(msg: UserShareWebcam) {
for {
uvo <- Users.userSharedWebcam(msg.userId, liveMeeting.users, msg.stream)
} yield {
log.info("User shared webcam. meetingId=" + props.meetingProp.intId + " userId=" + uvo.id + " stream=" + msg.stream)
outGW.send(new UserSharedWebcam(props.meetingProp.intId, props.recordProp.record, uvo.id, msg.stream))
}
}
def handleUserunshareWebcam(msg: UserUnshareWebcam) {
for {
uvo <- Users.userUnsharedWebcam(msg.userId, liveMeeting.users, msg.stream)
} yield {
log.info("User unshared webcam. meetingId=" + props.meetingProp.intId + " userId=" + uvo.id + " stream=" + msg.stream)
outGW.send(new UserUnsharedWebcam(props.meetingProp.intId, props.recordProp.record, uvo.id, msg.stream))
}
}
def handleChangeUserStatus(msg: ChangeUserStatus): Unit = {
if (Users.hasUserWithId(msg.userID, liveMeeting.users)) {
outGW.send(new UserStatusChange(props.meetingProp.intId, props.recordProp.record, msg.userID, msg.status, msg.value))
}
}
def handleGetUsers(msg: GetUsers): Unit = {
outGW.send(new GetUsersReply(msg.meetingID, msg.requesterID, Users.getUsers(liveMeeting.users).toArray))

View File

@ -1,6 +1,6 @@
package org.bigbluebutton.core.running
import java.io.{ PrintWriter, StringWriter }
import java.io.{PrintWriter, StringWriter}
import akka.actor._
import akka.actor.ActorLogging
@ -14,9 +14,10 @@ import org.bigbluebutton.core._
import org.bigbluebutton.core.api._
import org.bigbluebutton.core.apps._
import org.bigbluebutton.core.bus._
import org.bigbluebutton.core.models.{ RegisteredUsers, Users }
import org.bigbluebutton.core.models.{RegisteredUsers, Users}
import org.bigbluebutton.core2.MeetingStatus2x
import org.bigbluebutton.core2.message.handlers._
import org.bigbluebutton.core2.message.handlers.users._
import scala.concurrent.duration._
@ -42,7 +43,20 @@ class MeetingActor(val props: DefaultProps,
with UserConnectedToGlobalAudioHdlr
with UserDisconnectedFromGlobalAudioHdlr
with MuteAllExceptPresenterRequestHdlr
with MuteMeetingRequestHdlr {
with MuteMeetingRequestHdlr
with IsMeetingMutedRequestHdlr
with MuteUserRequestHdlr
with EjectUserFromVoiceRequestHdlr
with GetLockSettingsHdlr
with SetLockSettingsHdlr
with LockUserRequestHdlr
with InitLockSettingsHdlr
with InitAudioSettingsHdlr
with UserEmojiStatusHdlr
with EjectUserFromMeetingHdlr
with UserShareWebcamHdlr
with UserUnshareWebcamHdlr
with ChangeUserStatusHdlr {
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {

View File

@ -0,0 +1,26 @@
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ EjectUserFromVoiceRequest, EjectVoiceUser }
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
trait EjectUserFromVoiceRequestHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleEjectUserRequest(msg: EjectUserFromVoiceRequest) {
log.info("Received eject user request. meetingId=" + msg.meetingID + " userId=" + msg.userId)
for {
u <- Users.findWithId(msg.userId, liveMeeting.users)
} yield {
if (u.voiceUser.joined) {
log.info("Ejecting user from voice. meetingId=" + props.meetingProp.intId + " userId=" + u.id)
outGW.send(new EjectVoiceUser(props.meetingProp.intId, props.recordProp.record, msg.ejectedBy, u.id,
props.voiceProp.voiceConf, u.voiceUser.userId))
}
}
}
}

View File

@ -0,0 +1,24 @@
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{InitAudioSettings, MuteAllExceptPresenterRequest}
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
trait InitAudioSettingsHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleInitAudioSettings(msg: InitAudioSettings) {
if (!MeetingStatus2x.audioSettingsInitialized(liveMeeting.status)) {
MeetingStatus2x.initializeAudioSettings(liveMeeting.status)
if (MeetingStatus2x.isMeetingMuted(liveMeeting.status) != msg.muted) {
handleMuteAllExceptPresenterRequest(
new MuteAllExceptPresenterRequest(props.meetingProp.intId,
msg.requesterID, msg.muted));
}
}
}
}

View File

@ -0,0 +1,17 @@
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ IsMeetingMutedReply, IsMeetingMutedRequest }
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
trait IsMeetingMutedRequestHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleIsMeetingMutedRequest(msg: IsMeetingMutedRequest) {
outGW.send(new IsMeetingMutedReply(props.meetingProp.intId, props.recordProp.record,
msg.requesterID, MeetingStatus2x.isMeetingMuted(liveMeeting.status)))
}
}

View File

@ -44,10 +44,10 @@ trait MuteAllExceptPresenterRequestHdlr {
// I think the correct flow would be to find those who are presenters and exclude them
// from the list of voice users. The remaining, mute.
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach {vu =>
if (! vu.listenOnly) {
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { vu =>
if (!vu.listenOnly) {
Users2x.findWithIntId(liveMeeting.users2x, vu.intId) match {
case Some(u) => if (! u.presenter) muteUserInVoiceConf(vu)
case Some(u) => if (!u.presenter) muteUserInVoiceConf(vu)
case None => muteUserInVoiceConf(vu)
}
}

View File

@ -1,14 +1,13 @@
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.common2.messages._
import org.bigbluebutton.common2.messages.voiceconf.{MuteUserInVoiceConfMsg, MuteUserInVoiceConfMsgBody}
import org.bigbluebutton.common2.messages.voiceconf.{ MuteUserInVoiceConfMsg, MuteUserInVoiceConfMsgBody }
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{MeetingMuted, MuteMeetingRequest, MuteVoiceUser}
import org.bigbluebutton.core.models.{Users, Users2x, VoiceUserState, VoiceUsers}
import org.bigbluebutton.core.api.{ MeetingMuted, MuteMeetingRequest, MuteVoiceUser }
import org.bigbluebutton.core.models.{ Users, VoiceUserState, VoiceUsers }
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
trait MuteMeetingRequestHdlr {
this: MeetingActor =>
@ -20,6 +19,7 @@ trait MuteMeetingRequestHdlr {
} else {
MeetingStatus2x.unmuteMeeting(liveMeeting.status)
}
outGW.send(new MeetingMuted(props.meetingProp.intId, props.recordProp.record,
MeetingStatus2x.isMeetingMuted(liveMeeting.status)))
@ -41,8 +41,8 @@ trait MuteMeetingRequestHdlr {
}
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach {vu =>
if (! vu.listenOnly) {
VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { vu =>
if (!vu.listenOnly) {
muteUserInVoiceConf(vu)
}
}

View File

@ -0,0 +1,24 @@
package org.bigbluebutton.core2.message.handlers
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ NewPermissionsSetting, SetLockSettings }
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
trait SetLockSettingsHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleSetLockSettings(msg: SetLockSettings) {
if (!liveMeeting.permissionsEqual(msg.settings)) {
liveMeeting.newPermissions(msg.settings)
outGW.send(new NewPermissionsSetting(props.meetingProp.intId, msg.setByUser,
MeetingStatus2x.getPermissions(liveMeeting.status),
Users.getUsers(liveMeeting.users).toArray))
handleLockLayout(msg.settings.lockedLayout, msg.setByUser)
}
}
}

View File

@ -0,0 +1,23 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ChangeUserRole, UserRoleChange}
import org.bigbluebutton.core.models.{RegisteredUsers, Roles, Users}
import org.bigbluebutton.core.running.MeetingActor
trait ChangeUserRoleHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleChangeUserRole(msg: ChangeUserRole) {
for {
uvo <- Users.changeRole(msg.userID, liveMeeting.users, msg.role)
} yield {
RegisteredUsers.updateRegUser(uvo, liveMeeting.registeredUsers)
val userRole = if (msg.role == Roles.MODERATOR_ROLE) "MODERATOR" else "VIEWER"
outGW.send(new UserRoleChange(props.meetingProp.intId, props.recordProp.record, msg.userID, userRole))
}
}
}

View File

@ -0,0 +1,20 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ChangeUserStatus, UserStatusChange}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
trait ChangeUserStatusHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleChangeUserStatus(msg: ChangeUserStatus): Unit = {
if (Users.hasUserWithId(msg.userID, liveMeeting.users)) {
outGW.send(new UserStatusChange(props.meetingProp.intId, props.recordProp.record, msg.userID, msg.status, msg.value))
}
}
}

View File

@ -0,0 +1,31 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api._
import org.bigbluebutton.core.models.{RegisteredUsers, Users}
import org.bigbluebutton.core.running.MeetingActor
trait EjectUserFromMeetingHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleEjectUserFromMeeting(msg: EjectUserFromMeeting) {
for {
user <- Users.userLeft(msg.userId, liveMeeting.users)
} yield {
if (user.voiceUser.joined) {
outGW.send(new EjectVoiceUser(props.meetingProp.intId, props.recordProp.record,
msg.ejectedBy, msg.userId, props.voiceProp.voiceConf, user.voiceUser.userId))
}
RegisteredUsers.remove(msg.userId, liveMeeting.registeredUsers)
makeSurePresenterIsAssigned(user)
log.info("Ejecting user from meeting. meetingId=" + props.meetingProp.intId + " userId=" + msg.userId)
outGW.send(new UserEjectedFromMeeting(props.meetingProp.intId, props.recordProp.record, msg.userId, msg.ejectedBy))
outGW.send(new DisconnectUser(props.meetingProp.intId, msg.userId))
outGW.send(new UserLeft(msg.meetingID, props.recordProp.record, user))
}
}
}

View File

@ -0,0 +1,22 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{GetLockSettings, NewPermissionsSetting}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
trait GetLockSettingsHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleGetLockSettings(msg: GetLockSettings) {
//println("*************** Reply with current lock settings ********************")
//reusing the existing handle for NewPermissionsSettings to reply to the GetLockSettings request
outGW.send(new NewPermissionsSetting(props.meetingProp.intId, msg.userId,
MeetingStatus2x.getPermissions(liveMeeting.status),
Users.getUsers(liveMeeting.users).toArray))
}
}

View File

@ -0,0 +1,22 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{InitLockSettings, PermissionsSettingInitialized}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x
trait InitLockSettingsHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleInitLockSettings(msg: InitLockSettings) {
if (!MeetingStatus2x.permisionsInitialized(liveMeeting.status)) {
MeetingStatus2x.initializePermissions(liveMeeting.status)
liveMeeting.newPermissions(msg.settings)
outGW.send(new PermissionsSettingInitialized(msg.meetingID, msg.settings,
Users.getUsers(liveMeeting.users).toArray))
}
}
}

View File

@ -0,0 +1,21 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{LockUserRequest, UserLocked}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
trait LockUserRequestHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleLockUserRequest(msg: LockUserRequest) {
for {
uvo <- Users.lockUser(msg.userID, msg.lock, liveMeeting.users)
} yield {
log.info("Lock user. meetingId=" + props.meetingProp.intId + " userId=" + uvo.id + " locked=" + uvo.locked)
outGW.send(new UserLocked(props.meetingProp.intId, uvo.id, uvo.locked))
}
}
}

View File

@ -0,0 +1,23 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{MuteUserRequest, MuteVoiceUser}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
trait MuteUserRequestHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleMuteUserRequest(msg: MuteUserRequest) {
log.info("Received mute user request. meetingId=" + props.meetingProp.intId + " userId=" + msg.userID + " mute=" + msg.mute)
for {
u <- Users.findWithId(msg.userID, liveMeeting.users)
} yield {
log.info("Send mute user request. meetingId=" + props.meetingProp.intId + " userId=" + u.id + " user=" + u)
outGW.send(new MuteVoiceUser(props.meetingProp.intId, props.recordProp.record,
msg.requesterID, u.id, props.voiceProp.voiceConf, u.voiceUser.userId, msg.mute))
}
}
}

View File

@ -1,9 +1,9 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.common2.messages.MessageBody.UserBroadcastCamStartedEvtMsgBody
import org.bigbluebutton.common2.messages._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.{ MediaStream, WebcamStream, Webcams }
import org.bigbluebutton.core.models.{MediaStream, WebcamStream, Webcams}
import org.bigbluebutton.core.running.MeetingActor
trait UserBroadcastCamStartMsgHdlr {

View File

@ -1,9 +1,9 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.common2.messages.MessageBody.UserBroadcastCamStoppedEvtMsgBody
import org.bigbluebutton.common2.messages._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.{ Users, Webcams }
import org.bigbluebutton.core.models.Webcams
import org.bigbluebutton.core.running.MeetingActor
trait UserBroadcastCamStopMsgHdlr {

View File

@ -1,10 +1,10 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.common2.messages._
import org.bigbluebutton.common2.messages.voiceconf.{ UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody }
import org.bigbluebutton.common2.messages.voiceconf.{UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody}
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ UserConnectedToGlobalAudio, UserListeningOnly }
import org.bigbluebutton.core.models.{ Users, Users2x, VoiceUserState, VoiceUsers }
import org.bigbluebutton.core.api.{UserConnectedToGlobalAudio, UserListeningOnly}
import org.bigbluebutton.core.models.{Users, Users2x, VoiceUserState, VoiceUsers}
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x

View File

@ -1,10 +1,10 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.common2.messages._
import org.bigbluebutton.common2.messages.voiceconf.{ UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody, UserLeftVoiceConfToClientEvtMsg, UserLeftVoiceConfToClientEvtMsgBody }
import org.bigbluebutton.common2.messages.voiceconf.{UserLeftVoiceConfToClientEvtMsg, UserLeftVoiceConfToClientEvtMsgBody}
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{ UserDisconnectedFromGlobalAudio, UserLeft, UserListeningOnly }
import org.bigbluebutton.core.models.{ Users, Users2x, VoiceUserState, VoiceUsers }
import org.bigbluebutton.core.api.{UserDisconnectedFromGlobalAudio, UserLeft, UserListeningOnly}
import org.bigbluebutton.core.models.{Users, VoiceUserState, VoiceUsers}
import org.bigbluebutton.core.running.MeetingActor
import org.bigbluebutton.core2.MeetingStatus2x

View File

@ -0,0 +1,21 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{UserChangedEmojiStatus, UserEmojiStatus}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
trait UserEmojiStatusHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleUserEmojiStatus(msg: UserEmojiStatus) {
for {
uvo <- Users.setEmojiStatus(msg.userId, liveMeeting.users, msg.emojiStatus)
} yield {
outGW.send(new UserChangedEmojiStatus(props.meetingProp.intId, props.recordProp.record, msg.emojiStatus, uvo.id))
}
}
}

View File

@ -1,8 +1,8 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.common2.messages._
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.{ RegisteredUsers, UserState, Users2x, UsersState }
import org.bigbluebutton.core.models.{RegisteredUsers, UserState, Users2x}
import org.bigbluebutton.core.running.MeetingActor
trait UserJoinMeetingReqMsgHdlr {

View File

@ -1,9 +1,9 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.common2.messages._
import org.bigbluebutton.common2.messages.voiceconf.{ UserJoinedVoiceConfEvtMsg, UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody }
import org.bigbluebutton.common2.messages.voiceconf.{UserJoinedVoiceConfEvtMsg, UserJoinedVoiceConfToClientEvtMsg, UserJoinedVoiceConfToClientEvtMsgBody}
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.models.{ VoiceUser2x, VoiceUserState, VoiceUsers, VoiceUsersState }
import org.bigbluebutton.core.models.{VoiceUser2x, VoiceUserState, VoiceUsers}
import org.bigbluebutton.core.running.MeetingActor
trait UserJoinedVoiceConfEvtMsgHdlr {

View File

@ -1,4 +1,4 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
/**
* Created by ritz on 2017-06-09.

View File

@ -1,4 +1,4 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
/**
* Created by ritz on 2017-06-09.

View File

@ -0,0 +1,22 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{UserShareWebcam, UserSharedWebcam}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
trait UserShareWebcamHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleUserShareWebcam(msg: UserShareWebcam) {
for {
uvo <- Users.userSharedWebcam(msg.userId, liveMeeting.users, msg.stream)
} yield {
log.info("User shared webcam. meetingId=" + props.meetingProp.intId + " userId=" + uvo.id + " stream=" + msg.stream)
outGW.send(new UserSharedWebcam(props.meetingProp.intId, props.recordProp.record, uvo.id, msg.stream))
}
}
}

View File

@ -1,4 +1,4 @@
package org.bigbluebutton.core2.message.handlers
package org.bigbluebutton.core2.message.handlers.users
/**
* Created by ritz on 2017-06-09.

View File

@ -0,0 +1,21 @@
package org.bigbluebutton.core2.message.handlers.users
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.{UserUnshareWebcam, UserUnsharedWebcam}
import org.bigbluebutton.core.models.Users
import org.bigbluebutton.core.running.MeetingActor
trait UserUnshareWebcamHdlr {
this: MeetingActor =>
val outGW: OutMessageGateway
def handleUserunshareWebcam(msg: UserUnshareWebcam) {
for {
uvo <- Users.userUnsharedWebcam(msg.userId, liveMeeting.users, msg.stream)
} yield {
log.info("User unshared webcam. meetingId=" + props.meetingProp.intId + " userId=" + uvo.id + " stream=" + msg.stream)
outGW.send(new UserUnsharedWebcam(props.meetingProp.intId, props.recordProp.record, uvo.id, msg.stream))
}
}
}

View File

@ -0,0 +1,28 @@
package org.bigbluebutton.core.model
{
public class LiveMeeting
{
private static var instance: LiveMeeting = null;
var webcams: Webcams = new Webcams();
var voiceUsers: VoiceUsers2x = new VoiceUsers2x();
var users: Users2x = new Users2x();
public function LiveMeeting(enforcer: LiveMeetingSingletonEnforcer)
{
if (enforcer == null){
throw new Error("There can only be 1 LiveMeeting instance");
}
}
public static function getInstance():LiveMeeting{
if (instance == null){
instance = new LiveMeeting(new LiveMeetingSingletonEnforcer());
}
return instance;
}
}
}
class LiveMeetingSingletonEnforcer{}

View File

@ -0,0 +1,27 @@
package org.bigbluebutton.modules.users.views.model
{
public class User
{
[Bindable] public var me:Boolean = false;
[Bindable] public var userID:String = "UNKNOWN USER";
[Bindable] public var externUserID:String = "UNKNOWN USER";
[Bindable] public var name:String;
[Bindable] public var talking:Boolean = false;
[Bindable] public var phoneUser:Boolean = false;
[Bindable] public var listenOnly:Boolean = false;
[Bindable] public var disableMyCam:Boolean = false;
[Bindable] public var disableMyMic:Boolean = false;
[Bindable] public var disableMyPrivateChat:Boolean = false;
[Bindable] public var disableMyPublicChat:Boolean = false;
[Bindable] public var lockedLayout:Boolean = false;
[Bindable] public var avatarURL:String="";
[Bindable] public var guest:Boolean = false;
[Bindable] public var waitingForAcceptance:Boolean = false;
public function User()
{
}
}
}

View File

@ -0,0 +1,11 @@
package org.bigbluebutton.modules.users.views.model
{
public class UsersViewModel
{
private var _users:ArrayCollection = new ArrayCollection();
public function UsersViewModel()
{
}
}
}