Combined traits for group chats and group chat messages
This commit is contained in:
parent
eef2d65d93
commit
2e0b9f9798
3
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/GroupChatHdlrs.scala
Executable file → Normal file
3
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/GroupChatHdlrs.scala
Executable file → Normal file
@ -9,8 +9,7 @@ class GroupChatHdlrs(implicit val context: ActorContext)
|
||||
with GetGroupChatMsgsReqMsgHdlr
|
||||
with GetGroupChatsReqMsgHdlr
|
||||
with SendGroupChatMessageMsgHdlr
|
||||
with SyncGetGroupChatsMsgHdlr
|
||||
with SyncGetGroupChatMsgsMsgHdlr {
|
||||
with SyncGetGroupChatsInfoMsgHdlr {
|
||||
|
||||
val log = Logging(context.system, getClass)
|
||||
}
|
||||
|
@ -1,31 +0,0 @@
|
||||
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.running.LiveMeeting
|
||||
|
||||
trait SyncGetGroupChatMsgsMsgHdlr {
|
||||
this: GroupChatHdlrs =>
|
||||
|
||||
def handleSyncGetGroupChatMsgs(state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
|
||||
|
||||
def buildSyncGetGroupChatMsgsRespMsg(msgs: Vector[GroupChatMsgToUser], chatId: String): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetGroupChatMsgsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetGroupChatMsgsRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val body = SyncGetGroupChatMsgsRespMsgBody(chatId, msgs)
|
||||
val event = SyncGetGroupChatMsgsRespMsg(header, body)
|
||||
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
GroupChatApp.getAllGroupChatsInMeeting(state) foreach { gc =>
|
||||
val msgs = gc.msgs.toVector map (m => GroupChatMsgToUser(m.id, m.createdOn, m.correlationId,
|
||||
m.sender, m.color, m.message))
|
||||
val respMsg = buildSyncGetGroupChatMsgsRespMsg(msgs, gc.id)
|
||||
bus.outGW.send(respMsg)
|
||||
}
|
||||
|
||||
state
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
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.running.LiveMeeting
|
||||
|
||||
trait SyncGetGroupChatsInfoMsgHdlr {
|
||||
this: GroupChatHdlrs =>
|
||||
|
||||
def handleSyncGetGroupChatsInfo(state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
|
||||
|
||||
def buildSyncGetGroupChatsRespMsg(allChats: Vector[GroupChatInfo]): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetGroupChatsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetGroupChatsRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val body = SyncGetGroupChatsRespMsgBody(allChats)
|
||||
val event = SyncGetGroupChatsRespMsg(header, body)
|
||||
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
def buildSyncGetGroupChatMsgsRespMsg(msgs: Vector[GroupChatMsgToUser], chatId: String): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetGroupChatMsgsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetGroupChatMsgsRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val body = SyncGetGroupChatMsgsRespMsgBody(chatId, msgs)
|
||||
val event = SyncGetGroupChatMsgsRespMsg(header, body)
|
||||
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
// fetching all the group chats in the meeting
|
||||
val chats = GroupChatApp.getAllGroupChatsInMeeting(state)
|
||||
|
||||
// mapping group chats, while fetching and publishing messages for each group chat
|
||||
val allChats = chats map (pc => {
|
||||
|
||||
val msgs = pc.msgs.toVector map (m => GroupChatMsgToUser(m.id, m.createdOn, m.correlationId,
|
||||
m.sender, m.color, m.message))
|
||||
val respMsg = buildSyncGetGroupChatMsgsRespMsg(msgs, pc.id)
|
||||
bus.outGW.send(respMsg)
|
||||
|
||||
GroupChatInfo(pc.id, pc.name, pc.access, pc.createdBy, pc.users)
|
||||
})
|
||||
|
||||
// publishing a message with the group chat info
|
||||
val respMsg = buildSyncGetGroupChatsRespMsg(allChats)
|
||||
bus.outGW.send(respMsg)
|
||||
|
||||
state
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
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.running.LiveMeeting
|
||||
|
||||
trait SyncGetGroupChatsMsgHdlr {
|
||||
this: GroupChatHdlrs =>
|
||||
|
||||
def handleSyncGetGroupChats(state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
|
||||
|
||||
def buildSyncGetGroupChatsRespMsg(allChats: Vector[GroupChatInfo]): BbbCommonEnvCoreMsg = {
|
||||
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(SyncGetGroupChatsRespMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(SyncGetGroupChatsRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp")
|
||||
val body = SyncGetGroupChatsRespMsgBody(allChats)
|
||||
val event = SyncGetGroupChatsRespMsg(header, body)
|
||||
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
val chats = GroupChatApp.getAllGroupChatsInMeeting(state)
|
||||
val allChats = chats map (pc => GroupChatInfo(pc.id, pc.name, pc.access, pc.createdBy, pc.users))
|
||||
val respMsg = buildSyncGetGroupChatsRespMsg(allChats)
|
||||
bus.outGW.send(respMsg)
|
||||
|
||||
state
|
||||
}
|
||||
}
|
7
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
Executable file → Normal file
7
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
Executable file → Normal file
@ -362,11 +362,8 @@ class MeetingActor(
|
||||
// sync all presentations
|
||||
presentationPodsApp.handleSyncGetPresentationPods(state, liveMeeting, msgBus)
|
||||
|
||||
// sync all group chats
|
||||
groupChatApp.handleSyncGetGroupChats(state, liveMeeting, msgBus)
|
||||
|
||||
// sync all group chat messages
|
||||
groupChatApp.handleSyncGetGroupChatMsgs(state, liveMeeting, msgBus)
|
||||
// sync all group chats and group chat messages
|
||||
groupChatApp.handleSyncGetGroupChatsInfo(state, liveMeeting, msgBus)
|
||||
|
||||
// TODO send all lock settings
|
||||
// TODO send all screen sharing info
|
||||
|
Loading…
Reference in New Issue
Block a user