Added a message for when a default group chat is being created

This commit is contained in:
Oleksandr Zhurbenko 2018-03-27 15:09:26 -07:00
parent 32041e7a86
commit 9141ae51fd
7 changed files with 45 additions and 14 deletions

View File

@ -0,0 +1,38 @@
package org.bigbluebutton.core.apps.groupchats
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.GroupChat
import org.bigbluebutton.core.running.LiveMeeting
import org.bigbluebutton.core.models.SystemUser
trait CreateDefaultPublicGroupChat {
this: GroupChatHdlrs =>
def handleCreateDefaultPublicGroupChat(state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
val groupChat: GroupChat = GroupChatApp.createDefaultPublicGroupChat()
def buildGroupChatCreatedEvtMsg(meetingId: String, userId: String, gc: GroupChat): BbbCommonEnvCoreMsg = {
val correlationId = "SYSTEM-" + System.currentTimeMillis()
val msgs = gc.msgs.map(m => GroupChatApp.toMessageToUser(m))
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(GroupChatCreatedEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(GroupChatCreatedEvtMsg.NAME, meetingId, userId)
val body = GroupChatCreatedEvtMsgBody(correlationId, gc.id, gc.createdBy, gc.name, gc.access, gc.users, msgs)
val event = GroupChatCreatedEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
val respMsg = buildGroupChatCreatedEvtMsg(
liveMeeting.props.meetingProp.intId,
SystemUser.ID,
groupChat
)
bus.outGW.send(respMsg)
val groupChats = state.groupChats.add(groupChat)
state.update(groupChats)
}
}

View File

@ -44,12 +44,9 @@ object GroupChatApp {
}
}
def createDefaultPublicGroupChat(chatId: String, state: MeetingState2x): MeetingState2x = {
def createDefaultPublicGroupChat(): GroupChat = {
val createBy = GroupChatUser(SystemUser.ID, SystemUser.ID)
val defaultPubGroupChat = GroupChatFactory.create(chatId, chatId,
GroupChatAccess.PUBLIC, createBy, Vector.empty, Vector.empty)
val groupChats = state.groupChats.add(defaultPubGroupChat)
state.update(groupChats)
GroupChatFactory.create(MAIN_PUBLIC_CHAT, MAIN_PUBLIC_CHAT, GroupChatAccess.PUBLIC, createBy, Vector.empty, Vector.empty)
}
def createTestPublicGroupChat(state: MeetingState2x): MeetingState2x = {

View File

@ -5,6 +5,7 @@ import akka.event.Logging
class GroupChatHdlrs(implicit val context: ActorContext)
extends CreateGroupChatReqMsgHdlr
with CreateDefaultPublicGroupChat
with GetGroupChatMsgsReqMsgHdlr
with GetGroupChatsReqMsgHdlr
with SendGroupChatMessageMsgHdlr {

View File

@ -1,7 +1,5 @@
package org.bigbluebutton.core.apps.presentationpod
import org.bigbluebutton.common2.domain.PresentationPodVO
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.PresentationPod
@ -26,5 +24,4 @@ trait CreateDefaultPresentationPod {
val pods = state.presentationPodManager.addPod(resultPod)
state.update(pods)
}
}

View File

@ -32,7 +32,6 @@ trait CreateNewPresentationPodPubMsgHdlr extends RightsManagementTrait {
resultPod.id,
msg.header.userId
)
bus.outGW.send(respMsg)
val pods = state.presentationPodManager.addPod(resultPod)

View File

@ -141,11 +141,11 @@ class MeetingActor(
var lastRttTestSentOn = System.currentTimeMillis()
// Create a default publish group chat
state = GroupChatApp.createDefaultPublicGroupChat(GroupChatApp.MAIN_PUBLIC_CHAT, state)
//state = GroupChatApp.genTestChatMsgHistory(GroupChatApp.MAIN_PUBLIC_CHAT, state, BbbSystemConst.SYSTEM_USER, liveMeeting)
// Create a default public group chat
state = groupChatApp.handleCreateDefaultPublicGroupChat(state, liveMeeting, msgBus)
// Create a default publish group chat
//state = GroupChatApp.genTestChatMsgHistory(GroupChatApp.MAIN_PUBLIC_CHAT, state, BbbSystemConst.SYSTEM_USER, liveMeeting)
// Create a default public group chat **DEPRECATED, NOT GOING TO WORK ANYMORE**
//state = GroupChatApp.createDefaultPublicGroupChat("TEST_GROUP_CHAT", state)
//state = GroupChatApp.genTestChatMsgHistory("TEST_GROUP_CHAT", state, BbbSystemConst.SYSTEM_USER, liveMeeting)

View File

@ -3,7 +3,6 @@ package org.bigbluebutton.core2.message.senders
import org.bigbluebutton.common2.domain.DefaultProps
import org.bigbluebutton.common2.msgs.{ BbbCommonEnvCoreMsg, BbbCoreEnvelope, BbbCoreHeaderWithMeetingId, MessageTypes, Routing, ValidateConnAuthTokenSysRespMsg, ValidateConnAuthTokenSysRespMsgBody, _ }
import org.bigbluebutton.core.models.GuestWaiting
import org.bigbluebutton.common2.domain.PresentationPodVO
object MsgBuilder {
def buildGuestPolicyChangedEvtMsg(meetingId: String, userId: String, policy: String, setBy: String): BbbCommonEnvCoreMsg = {