convert chat messages to 2x

This commit is contained in:
Chad Pilkey 2017-07-07 19:14:00 -04:00
parent fc3d7a05aa
commit 550b880db7
31 changed files with 460 additions and 361 deletions

View File

@ -12,12 +12,12 @@ trait ChatApp {
val outGW: OutMessageGateway
def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) {
val history = liveMeeting.chatModel.getChatHistory()
outGW.send(new GetChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID, msg.replyTo, history))
//val history = liveMeeting.chatModel.getChatHistory()
//outGW.send(new GetChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID, msg.replyTo, history))
}
def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) {
liveMeeting.chatModel.addNewChatMessage(msg.message)
//liveMeeting.chatModel.addNewChatMessage(msg.message)
val pubMsg = msg.message
outGW.send(new SendPublicMessageEvent(props.meetingProp.intId, props.recordProp.record, msg.requesterID, pubMsg))
@ -29,7 +29,7 @@ trait ChatApp {
}
def handleClearPublicChatHistoryRequest(msg: ClearPublicChatHistoryRequest) {
liveMeeting.chatModel.clearPublicChatHistory()
//liveMeeting.chatModel.clearPublicChatHistory()
outGW.send(new ClearPublicChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID))
}

View File

@ -1,29 +0,0 @@
package org.bigbluebutton.core.apps
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.api.SendDirectChatMsgCmd
import org.bigbluebutton.core.models.DirectChats
import org.bigbluebutton.core.running.LiveMeeting
trait ChatAppHandlers {
val liveMeeting: LiveMeeting
val outGW: OutMessageGateway
def handleSendDirectChatMsgCmd(msg: SendDirectChatMsgCmd): Unit = {
def send(): Unit = {
}
val between = Set("foo", "bar")
for {
chat <- DirectChats.find(between, liveMeeting.chatModel.directChats)
} yield {
send()
}
}
def handleCreatePublicChatCmd(): Unit = {
}
}

View File

@ -1,35 +1,28 @@
package org.bigbluebutton.core.apps
import org.bigbluebutton.common2.msgs.ChatMessageVO
import org.bigbluebutton.core.models.{ DirectChats, PublicChats }
import scala.collection.mutable.ArrayBuffer
object ChatModel {
def getChatHistory(chatModel: ChatModel): Array[Map[String, String]] = {
chatModel.getChatHistory()
def getChatHistory(chatModel: ChatModel): Array[ChatMessageVO] = {
chatModel.messages.toArray
}
def addNewChatMessage(chatModel: ChatModel, msg: ChatMessageVO) {
chatModel.messages.append(msg)
}
def clearPublicChatHistory(chatModel: ChatModel) {
chatModel.messages.clear()
}
}
class ChatModel {
val directChats = new DirectChats
val publicChats = new PublicChats
private val messages = new ArrayBuffer[Map[String, String]]()
def getChatHistory(): Array[Map[String, String]] = {
val history = new Array[Map[String, String]](messages.size)
messages.copyToArray(history)
history
}
def addNewChatMessage(msg: Map[String, String]) {
messages append msg
}
def clearPublicChatHistory() {
messages.clear();
}
}
//val directChats = new DirectChats
//val publicChats = new PublicChats
private val messages = new ArrayBuffer[ChatMessageVO]()
}

View File

@ -1,19 +0,0 @@
package org.bigbluebutton.core.apps
import org.bigbluebutton.core.running.LiveMeeting
trait ChatModelTrait {
this: LiveMeeting =>
def getChatHistory(): Array[Map[String, String]] = {
ChatModel.getChatHistory(chatModel)
}
def addNewChatMessage(msg: Map[String, String]) = {
chatModel.addNewChatMessage(msg)
}
def clearPublicChatHistory(): Unit = {
chatModel.clearPublicChatHistory()
}
}

View File

@ -0,0 +1,18 @@
package org.bigbluebutton.core.apps.chat
import akka.actor.ActorContext
import akka.event.Logging
import org.bigbluebutton.common2.msgs.TranscriptVO
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.core.running.LiveMeeting
class ChatApp2x(val liveMeeting: LiveMeeting,
val outGW: OutMessageGateway)(implicit val context: ActorContext)
extends GetChatHistoryReqMsgHdlr
with SendPublicMessagePubMsgHdlr
with SendPrivateMessagePubMsgHdlr
with ClearPublicChatHistoryPubMsgHdlr {
val log = Logging(context.system, getClass)
}

View File

@ -0,0 +1,30 @@
package org.bigbluebutton.core.apps.chat
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.apps.ChatModel
trait ClearPublicChatHistoryPubMsgHdlr {
this: ChatApp2x =>
val outGW: OutMessageGateway
def handleClearPublicChatHistoryPubMsg(msg: ClearPublicChatHistoryPubMsg): Unit = {
def broadcastEvent(msg: ClearPublicChatHistoryPubMsg): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
val envelope = BbbCoreEnvelope(ClearPublicChatHistoryEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(ClearPublicChatHistoryEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
val body = ClearPublicChatHistoryEvtMsgBody()
val event = ClearPublicChatHistoryEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
//record(event)
}
ChatModel.clearPublicChatHistory(liveMeeting.chatModel)
broadcastEvent(msg)
}
}

View File

@ -0,0 +1,27 @@
package org.bigbluebutton.core.apps.chat
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.apps.ChatModel
trait GetChatHistoryReqMsgHdlr {
this: ChatApp2x =>
val outGW: OutMessageGateway
def handleGetChatHistoryReqMsg(msg: GetChatHistoryReqMsg): Unit = {
def broadcastEvent(msg: GetChatHistoryReqMsg, history: Array[ChatMessageVO]): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, msg.header.userId)
val envelope = BbbCoreEnvelope(GetChatHistoryRespMsg.NAME, routing)
val header = BbbClientMsgHeader(GetChatHistoryRespMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
val body = GetChatHistoryRespMsgBody(history)
val event = GetChatHistoryRespMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
}
val history = ChatModel.getChatHistory(liveMeeting.chatModel)
broadcastEvent(msg, history)
}
}

View File

@ -0,0 +1,28 @@
package org.bigbluebutton.core.apps.chat
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.common2.msgs._
trait SendPrivateMessagePubMsgHdlr {
this: ChatApp2x =>
val outGW: OutMessageGateway
def handleSendPrivateMessagePubMsg(msg: SendPrivateMessagePubMsg): Unit = {
def broadcastEvent(message: ChatMessageVO, userId: String): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, userId)
val envelope = BbbCoreEnvelope(SendPrivateMessageEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(SendPrivateMessageEvtMsg.NAME, liveMeeting.props.meetingProp.intId, userId)
val body = SendPrivateMessageEvtMsgBody(message)
val event = SendPrivateMessageEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
//record(event)
}
broadcastEvent(msg.body.message, msg.body.message.fromUserId)
broadcastEvent(msg.body.message, msg.body.message.toUserId)
}
}

View File

@ -0,0 +1,29 @@
package org.bigbluebutton.core.apps.chat
import org.bigbluebutton.core.OutMessageGateway
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.apps.ChatModel
trait SendPublicMessagePubMsgHdlr {
this: ChatApp2x =>
val outGW: OutMessageGateway
def handleSendPublicMessagePubMsg(msg: SendPublicMessagePubMsg): Unit = {
def broadcastEvent(msg: SendPublicMessagePubMsg, message: ChatMessageVO): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
val envelope = BbbCoreEnvelope(SendPublicMessageEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(SendPublicMessageEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
val body = SendPublicMessageEvtMsgBody(msg.body.message)
val event = SendPublicMessageEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
//record(event)
}
ChatModel.addNewChatMessage(liveMeeting.chatModel, msg.body.message)
broadcastEvent(msg, msg.body.message)
}
}

View File

@ -295,6 +295,14 @@ class ReceivedJsonMsgHandlerActor(
routeGenericMsg[CreateSharedNoteReqMsg](envelope, jsonNode)
case DestroySharedNoteReqMsg.NAME =>
routeGenericMsg[DestroySharedNoteReqMsg](envelope, jsonNode)
case GetChatHistoryReqMsg.NAME =>
routeGenericMsg[GetChatHistoryReqMsg](envelope, jsonNode)
case SendPublicMessagePubMsg.NAME =>
routeGenericMsg[SendPublicMessagePubMsg](envelope, jsonNode)
case SendPrivateMessagePubMsg.NAME =>
routeGenericMsg[SendPrivateMessagePubMsg](envelope, jsonNode)
case ClearPublicChatHistoryPubMsg.NAME =>
routeGenericMsg[ClearPublicChatHistoryPubMsg](envelope, jsonNode)
case _ =>
log.error("Cannot route envelope name " + envelope.name)
// do nothing

View File

@ -9,24 +9,23 @@ import org.bigbluebutton.core.models._
import org.bigbluebutton.core2.MeetingStatus2x
class LiveMeeting(val props: DefaultProps,
val status: MeetingStatus2x,
val chatModel: ChatModel,
val layoutModel: LayoutModel,
val layouts: Layouts,
val users: Users1x,
val registeredUsers: RegisteredUsers,
val polls: Polls, // 2x
val pollModel: PollModel, // 1.1x
val wbModel: WhiteboardModel,
val presModel: PresentationModel,
val breakoutRooms: BreakoutRooms,
val captionModel: CaptionModel,
val notesModel: SharedNotesModel,
val webcams: Webcams,
val voiceUsers: VoiceUsers,
val users2x: Users2x,
val guestsWaiting: GuestsWaiting)
extends ChatModelTrait {
val status: MeetingStatus2x,
val chatModel: ChatModel,
val layoutModel: LayoutModel,
val layouts: Layouts,
val users: Users1x,
val registeredUsers: RegisteredUsers,
val polls: Polls, // 2x
val pollModel: PollModel, // 1.1x
val wbModel: WhiteboardModel,
val presModel: PresentationModel,
val breakoutRooms: BreakoutRooms,
val captionModel: CaptionModel,
val notesModel: SharedNotesModel,
val webcams: Webcams,
val voiceUsers: VoiceUsers,
val users2x: Users2x,
val guestsWaiting: GuestsWaiting) {
def hasMeetingEnded(): Boolean = {
MeetingStatus2x.hasMeetingEnded(status)

View File

@ -9,6 +9,7 @@ import org.bigbluebutton.core._
import org.bigbluebutton.core.api._
import org.bigbluebutton.core.apps._
import org.bigbluebutton.core.apps.caption.CaptionApp2x
import org.bigbluebutton.core.apps.chat.ChatApp2x
import org.bigbluebutton.core.apps.deskshare.DeskshareApp2x
import org.bigbluebutton.core.apps.presentation.PresentationApp2x
import org.bigbluebutton.core.apps.users.UsersApp2x
@ -103,6 +104,7 @@ class MeetingActor(val props: DefaultProps,
val deskshareApp2x = new DeskshareApp2x(liveMeeting, outGW = outGW)
val captionApp2x = new CaptionApp2x(liveMeeting, outGW = outGW)
val sharedNotesApp2x = new SharedNotesApp2x(liveMeeting, outGW = outGW)
val chatApp2x = new ChatApp2x(liveMeeting, outGW = outGW)
/*******************************************************************/
//object FakeTestData extends FakeTestData
@ -237,6 +239,12 @@ class MeetingActor(val props: DefaultProps,
case m: CreateSharedNoteReqMsg => sharedNotesApp2x.handleCreateSharedNoteReqMsg(m)
case m: DestroySharedNoteReqMsg => sharedNotesApp2x.handleDestroySharedNoteReqMsg(m)
// Chat
case m: GetChatHistoryReqMsg => chatApp2x.handleGetChatHistoryReqMsg(m)
case m: SendPublicMessagePubMsg => chatApp2x.handleSendPublicMessagePubMsg(m)
case m: SendPrivateMessagePubMsg => chatApp2x.handleSendPrivateMessagePubMsg(m)
case m: ClearPublicChatHistoryPubMsg => chatApp2x.handleClearPublicChatHistoryPubMsg(m)
//Guests
case m: GetGuestsWaitingApprovalReqMsg => handle(m)
case m: SetGuestPolicyMsg => handle(m)

View File

@ -0,0 +1,39 @@
package org.bigbluebutton.common2.msgs
/* In Messages */
object GetChatHistoryReqMsg { val NAME = "GetChatHistoryReqMsg"}
case class GetChatHistoryReqMsg(header: BbbClientMsgHeader, body: GetChatHistoryReqMsgBody) extends StandardMsg
case class GetChatHistoryReqMsgBody()
object SendPublicMessagePubMsg { val NAME = "SendPublicMessagePubMsg"}
case class SendPublicMessagePubMsg(header: BbbClientMsgHeader, body: SendPublicMessagePubMsgBody) extends StandardMsg
case class SendPublicMessagePubMsgBody(message: ChatMessageVO)
object SendPrivateMessagePubMsg { val NAME = "SendPrivateMessagePubMsg"}
case class SendPrivateMessagePubMsg(header: BbbClientMsgHeader, body: SendPrivateMessagePubMsgBody) extends StandardMsg
case class SendPrivateMessagePubMsgBody(message: ChatMessageVO)
object ClearPublicChatHistoryPubMsg { val NAME = "ClearPublicChatHistoryPubMsg"}
case class ClearPublicChatHistoryPubMsg(header: BbbClientMsgHeader, body: ClearPublicChatHistoryPubMsgBody) extends StandardMsg
case class ClearPublicChatHistoryPubMsgBody()
/* Out Messages */
object GetChatHistoryRespMsg { val NAME = "GetChatHistoryRespMsg"}
case class GetChatHistoryRespMsg(header: BbbClientMsgHeader, body: GetChatHistoryRespMsgBody) extends StandardMsg
case class GetChatHistoryRespMsgBody(history: Array[ChatMessageVO])
object SendPublicMessageEvtMsg { val NAME = "SendPublicMessageEvtMsg"}
case class SendPublicMessageEvtMsg(header: BbbClientMsgHeader, body: SendPublicMessageEvtMsgBody) extends StandardMsg
case class SendPublicMessageEvtMsgBody(message: ChatMessageVO)
object SendPrivateMessageEvtMsg { val NAME = "SendPrivateMessageEvtMsg"}
case class SendPrivateMessageEvtMsg(header: BbbClientMsgHeader, body: SendPrivateMessageEvtMsgBody) extends StandardMsg
case class SendPrivateMessageEvtMsgBody(message: ChatMessageVO)
object ClearPublicChatHistoryEvtMsg { val NAME = "ClearPublicChatHistoryEvtMsg"}
case class ClearPublicChatHistoryEvtMsg(header: BbbClientMsgHeader, body: ClearPublicChatHistoryEvtMsgBody) extends StandardMsg
case class ClearPublicChatHistoryEvtMsgBody()
case class ChatMessageVO(fromUserId: String, fromUsername: String, fromColor: String, fromTime: Long, fromTimezoneOffset: Int,
toUserId: String, toUsername: String, message: String)

View File

@ -23,9 +23,6 @@ package org.bigbluebutton.modules.chat.events
public class ChatEvent extends Event
{
public static const CHAT_EVENT:String = 'CHAT_EVENT';
public static const NEW_CHAT_MESSAGE_EVENT:String = 'NEW_CHAT_MESSAGE_EVENT';
public static const PRIVATE_CHAT_MESSAGE_EVENT:String = 'PRIVATE_CHAT_MESSAGE_EVENT';
public static const RESIZE_CHAT_TOOLBAR:String = 'RESIZE_CHAT_TOOLBAR';
public function ChatEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)

View File

@ -20,12 +20,14 @@ package org.bigbluebutton.modules.chat.events
{
import flash.events.Event;
public class TranscriptEvent extends Event
public class ChatHistoryEvent extends Event
{
public static const LOAD_TRANSCRIPT:String = "LOAD_TRANSCRIPT";
public static const TRANSCRIPT_EVENT:String = 'TRANSCRIPT_EVENT';
public static const REQUEST_HISTORY:String = "REQUEST_HISTORY";
public static const RECEIVED_HISTORY:String = 'RECEIVED_HISTORY';
public function TranscriptEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
public var history:Array;
public function ChatHistoryEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
}

View File

@ -27,7 +27,6 @@ package org.bigbluebutton.modules.chat.events
public static const PUBLIC_CHAT_MESSAGE_EVENT:String = 'PUBLIC_CHAT_MESSAGE_EVENT';
public var message:ChatMessageVO;
public var history:Boolean;
public function PublicChatMessageEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
{

View File

@ -39,7 +39,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.chat.events.SendPublicChatMessageEvent;
import org.bigbluebutton.modules.chat.events.StartChatModuleEvent;
import org.bigbluebutton.modules.chat.events.StopChatModuleEvent;
import org.bigbluebutton.modules.chat.events.TranscriptEvent;
import org.bigbluebutton.modules.chat.events.ChatHistoryEvent;
import org.bigbluebutton.modules.chat.services.ChatMessageService;
import org.bigbluebutton.modules.chat.services.MessageReceiver;
import org.bigbluebutton.modules.chat.services.MessageSender;
@ -79,16 +79,16 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{ChatMessageService}" method="sendPrivateMessage" arguments="{event.chatMessage}"/>
</EventHandlers>
<EventHandlers type="{TranscriptEvent.LOAD_TRANSCRIPT}" >
<EventHandlers type="{ChatHistoryEvent.REQUEST_HISTORY}" >
<MethodInvoker generator="{ChatMessageService}" method="getPublicChatMessages"/>
</EventHandlers>
<EventHandlers type="{TranscriptEvent.TRANSCRIPT_EVENT}" >
<EventHandlers type="{ChatHistoryEvent.RECEIVED_HISTORY}" >
<MethodInvoker generator="{ChatMessageService}" method="sendWelcomeMessage"/>
</EventHandlers>
<EventHandlers type="{BBBEvent.RECONNECT_BIGBLUEBUTTON_SUCCEEDED_EVENT}" >
<EventAnnouncer generator="{TranscriptEvent}" type="{TranscriptEvent.LOAD_TRANSCRIPT}"/>
<EventAnnouncer generator="{ChatHistoryEvent}" type="{ChatHistoryEvent.REQUEST_HISTORY}"/>
</EventHandlers>
<EventHandlers type="{ChatSaveEvent.SAVE_CHAT_EVENT}">

View File

@ -19,17 +19,16 @@
package org.bigbluebutton.modules.chat.model
{
import com.adobe.utils.StringUtil;
import com.asfusion.mate.events.Dispatcher;
import flash.system.Capabilities;
import mx.collections.ArrayCollection;
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.modules.chat.ChatUtil;
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.modules.chat.events.ChatHistoryEvent;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
import org.bigbluebutton.modules.chat.events.TranscriptEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
public class ChatConversation
{
@ -44,34 +43,65 @@ package org.bigbluebutton.modules.chat.model
}
public function newChatMessage(msg:ChatMessageVO):void {
var cm:ChatMessage = new ChatMessage();
if (messages.length == 0) {
cm.lastSenderId = "";
cm.lastTime = cm.time;
} else {
cm.lastSenderId = getLastSender();
cm.lastTime = getLastTime();
}
cm.senderId = msg.fromUserID;
cm.text = msg.message;
cm.name = msg.fromUsername;
cm.senderColor = uint(msg.fromColor);
// Welcome message will skip time
if (msg.fromTime != -1) {
cm.fromTime = msg.fromTime;
cm.fromTimezoneOffset = msg.fromTimezoneOffset;
var sentTime:Date = new Date();
sentTime.setTime(cm.fromTime);
cm.time = ChatUtil.getHours(sentTime) + ":" + ChatUtil.getMinutes(sentTime);
}
messages.addItem(cm);
var newCM:ChatMessage = convertChatMessage(msg);
if (messages.length > 0) {
var previousCM:ChatMessage = messages.getItemAt(messages.length-1) as ChatMessage;
newCM.lastSenderId = previousCM.senderId;
newCM.lastTime = previousCM.time;
}
messages.addItem(newCM);
}
public function processChatHistory(messageVOs:Array):void {
if (messageVOs.length > 0) {
var previousCM:ChatMessage = convertChatMessage(messageVOs[0] as ChatMessageVO);;
var newCM:ChatMessage;
messages.addItemAt(previousCM, 0);
for (var i:int=1; i < messageVOs.length; i++) {
newCM = convertChatMessage(messageVOs[i] as ChatMessageVO);
newCM.lastSenderId = previousCM.senderId;
newCM.lastTime = previousCM.time;
messages.addItemAt(newCM, i);
previousCM = newCM;
}
if (messageVOs.length < messages.length) {
newCM = messages.getItemAt(messageVOs.length) as ChatMessage;
newCM.lastSenderId = previousCM.senderId;
newCM.lastTime = previousCM.time;
}
}
}
private function convertChatMessage(msgVO:ChatMessageVO):ChatMessage {
var cm:ChatMessage = new ChatMessage();
cm.lastSenderId = "";
cm.lastTime = "";
cm.senderId = msgVO.fromUserId;
cm.text = msgVO.message;
cm.name = msgVO.fromUsername;
cm.senderColor = uint(msgVO.fromColor);
// Welcome message will skip time
if (msgVO.fromTime != -1) {
cm.fromTime = msgVO.fromTime;
cm.fromTimezoneOffset = msgVO.fromTimezoneOffset;
cm.time = convertTimeNumberToString(msgVO.fromTime);
}
return cm
}
private function convertTimeNumberToString(time:Number):String {
var sentTime:Date = new Date();
sentTime.setTime(time);
return ChatUtil.getHours(sentTime) + ":" + ChatUtil.getMinutes(sentTime);
}
public function getAllMessageAsString():String{
var allText:String = "";
var returnStr:String = (Capabilities.os.indexOf("Windows") >= 0 ? "\r\n" : "\n");
@ -85,28 +115,18 @@ package org.bigbluebutton.modules.chat.model
}
return allText;
}
private function getLastSender():String {
var msg:ChatMessage = messages.getItemAt(messages.length - 1) as ChatMessage;
return msg.senderId;
}
private function getLastTime():String {
var msg:ChatMessage = messages.getItemAt(messages.length - 1) as ChatMessage;
return msg.time;
}
public function clearPublicChat():void {
var cm:ChatMessage = new ChatMessage();
cm.time = getLastTime();
cm.text = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.clearBtn.chatMessage')+"</b></i>";
cm.time = convertTimeNumberToString(new Date().time);
cm.text = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.clearBtn.chatMessage')+"</i></b>";
cm.name = "";
cm.senderColor = uint(0x000000);
messages.removeAll();
messages.addItem(cm);
var welcomeEvent:TranscriptEvent = new TranscriptEvent(TranscriptEvent.TRANSCRIPT_EVENT);
var welcomeEvent:ChatHistoryEvent = new ChatHistoryEvent(ChatHistoryEvent.RECEIVED_HISTORY);
_dispatcher.dispatchEvent(welcomeEvent);
}
}

View File

@ -20,7 +20,7 @@ package org.bigbluebutton.modules.chat.model
}
public function newChatMessage(msg:ChatMessageVO):void {
var convId:String = getConvId(msg.fromUserID, msg.toUserID);
var convId:String = getConvId(msg.fromUserId, msg.toUserId);
if (convs.hasOwnProperty(convId)) {
var cm:ChatConversation = convs[convId] as ChatConversation;

View File

@ -43,8 +43,7 @@ package org.bigbluebutton.modules.chat.services
{
LOGGER.debug("sendPublicMessageFromApi");
var msgVO:ChatMessageVO = new ChatMessageVO();
msgVO.chatType = ChatConstants.PUBLIC_CHAT;
msgVO.fromUserID = message.fromUserID;
msgVO.fromUserId = message.fromUserID;
msgVO.fromUsername = message.fromUsername;
msgVO.fromColor = message.fromColor;
msgVO.fromTime = message.fromTime;
@ -59,14 +58,13 @@ package org.bigbluebutton.modules.chat.services
{
LOGGER.debug("sendPrivateMessageFromApi");
var msgVO:ChatMessageVO = new ChatMessageVO();
msgVO.chatType = ChatConstants.PUBLIC_CHAT;
msgVO.fromUserID = message.fromUserID;
msgVO.fromUserId = message.fromUserID;
msgVO.fromUsername = message.fromUsername;
msgVO.fromColor = message.fromColor;
msgVO.fromTime = message.fromTime;
msgVO.fromTimezoneOffset = message.fromTimezoneOffset;
msgVO.toUserID = message.toUserID;
msgVO.toUserId = message.toUserID;
msgVO.toUsername = message.toUsername;
msgVO.message = message.message;
@ -98,19 +96,17 @@ package org.bigbluebutton.modules.chat.services
var welcome:String = LiveMeeting.inst().me.welcome;
if (welcome != "") {
var welcomeMsg:ChatMessageVO = new ChatMessageVO();
welcomeMsg.chatType = ChatConstants.PUBLIC_CHAT;
welcomeMsg.fromUserID = SPACE;
welcomeMsg.fromUserId = SPACE;
welcomeMsg.fromUsername = SPACE;
welcomeMsg.fromColor = "86187";
welcomeMsg.fromTime = -1;
welcomeMsg.fromTime = new Date().getTime();
welcomeMsg.fromTimezoneOffset = new Date().getTimezoneOffset();
welcomeMsg.toUserID = SPACE;
welcomeMsg.toUserId = SPACE;
welcomeMsg.toUsername = SPACE;
welcomeMsg.message = welcome;
var welcomeMsgEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
welcomeMsgEvent.message = welcomeMsg;
welcomeMsgEvent.history = false;
dispatcher.dispatchEvent(welcomeMsgEvent);
//Say that client is ready when sending the welcome message
@ -120,19 +116,17 @@ package org.bigbluebutton.modules.chat.services
if (UsersUtil.amIModerator()) {
if (LiveMeeting.inst().meeting.modOnlyMessage != null) {
var moderatorOnlyMsg:ChatMessageVO = new ChatMessageVO();
moderatorOnlyMsg.chatType = ChatConstants.PUBLIC_CHAT;
moderatorOnlyMsg.fromUserID = SPACE;
moderatorOnlyMsg.fromUserId = SPACE;
moderatorOnlyMsg.fromUsername = SPACE;
moderatorOnlyMsg.fromColor = "86187";
moderatorOnlyMsg.fromTime = new Date().getTime();
moderatorOnlyMsg.fromTimezoneOffset = new Date().getTimezoneOffset();
moderatorOnlyMsg.toUserID = SPACE;
moderatorOnlyMsg.toUserId = SPACE;
moderatorOnlyMsg.toUsername = SPACE;
moderatorOnlyMsg.message = LiveMeeting.inst().meeting.modOnlyMessage;
var moderatorOnlyMsgEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
moderatorOnlyMsgEvent.message = moderatorOnlyMsg;
moderatorOnlyMsgEvent.history = false;
dispatcher.dispatchEvent(moderatorOnlyMsgEvent);
}
}

View File

@ -26,19 +26,17 @@ package org.bigbluebutton.modules.chat.services
import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.main.model.users.IMessageListener;
import org.bigbluebutton.modules.chat.events.ClearPublicChatEvent;
import org.bigbluebutton.modules.chat.events.PrivateChatMessageEvent;
import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent;
import org.bigbluebutton.modules.chat.events.TranscriptEvent;
import org.bigbluebutton.modules.chat.events.ClearPublicChatEvent;
import org.bigbluebutton.modules.chat.events.ChatHistoryEvent;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
public class MessageReceiver implements IMessageListener
{
private static const LOGGER:ILogger = getClassLogger(MessageReceiver);
private var welcomed:Boolean = false;
private static const LOGGER:ILogger = getClassLogger(MessageReceiver);
public var dispatcher:IEventDispatcher;
public function MessageReceiver()
@ -49,55 +47,44 @@ package org.bigbluebutton.modules.chat.services
public function onMessage(messageName:String, message:Object):void
{
switch (messageName) {
case "ChatReceivePublicMessageCommand":
handleChatReceivePublicMessageCommand(message);
case "SendPublicMessageEvtMsg":
handleSendPublicMessageEvtMsg(message);
break;
case "ChatReceivePrivateMessageCommand":
handleChatReceivePrivateMessageCommand(message);
case "SendPrivateMessageEvtMsg":
handleSendPrivateMessageEvtMsg(message);
break;
case "ChatRequestMessageHistoryReply":
handleChatRequestMessageHistoryReply(message);
case "GetChatHistoryRespMsg":
handleGetChatHistoryRespMsg(message);
break;
case "ChatClearPublicMessageCommand":
handleChatClearPublicMessageCommand(message);
case "ClearPublicChatHistoryEvtMsg":
handleClearPublicChatHistoryEvtMsg(message);
break;
default:
// LogUtil.warn("Cannot handle message [" + messageName + "]");
}
}
private function handleChatRequestMessageHistoryReply(message:Object):void {
LOGGER.debug("Handling chat history message [{0}]", [message.msg]);
var chats:Array = JSON.parse(message.msg) as Array;
private function handleGetChatHistoryRespMsg(message:Object):void {
LOGGER.debug("Handling chat history message [{0}]", [message.body.history]);
var rawMessages:Array = message.body.history as Array;
var processedMessages:Array = new Array();
for (var i:int = 0; i < chats.length; i++) {
handleChatReceivePublicMessageCommand(chats[i], true);
for (var i:int = 0; i < rawMessages.length; i++) {
processedMessages.push(processIncomingChatMessage(rawMessages[i]));
}
// if (!welcomed) {
var pcEvent:TranscriptEvent = new TranscriptEvent(TranscriptEvent.TRANSCRIPT_EVENT);
dispatcher.dispatchEvent(pcEvent);
// welcomed = true;
// }
var chEvent:ChatHistoryEvent = new ChatHistoryEvent(ChatHistoryEvent.RECEIVED_HISTORY);
chEvent.history = processedMessages;
dispatcher.dispatchEvent(chEvent);
}
private function handleChatReceivePublicMessageCommand(message:Object, history:Boolean = false):void {
private function handleSendPublicMessageEvtMsg(message:Object, history:Boolean = false):void {
LOGGER.debug("Handling public chat message [{0}]", [message.message]);
var msg:ChatMessageVO = new ChatMessageVO();
msg.chatType = message.chatType;
msg.fromUserID = message.fromUserID;
msg.fromUsername = message.fromUsername;
msg.fromColor = message.fromColor;
msg.fromTime = message.fromTime;
msg.fromTimezoneOffset = message.fromTimezoneOffset;
msg.toUserID = message.toUserID;
msg.toUsername = message.toUsername;
msg.message = message.message;
var msg:ChatMessageVO = processIncomingChatMessage(message.body.message);
var pcEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
pcEvent.message = msg;
pcEvent.history = history;
dispatcher.dispatchEvent(pcEvent);
var pcCoreEvent:CoreEvent = new CoreEvent(EventConstants.NEW_PUBLIC_CHAT);
@ -105,19 +92,10 @@ package org.bigbluebutton.modules.chat.services
dispatcher.dispatchEvent(pcCoreEvent);
}
private function handleChatReceivePrivateMessageCommand(message:Object):void {
private function handleSendPrivateMessageEvtMsg(message:Object):void {
LOGGER.debug("Handling private chat message");
var msg:ChatMessageVO = new ChatMessageVO();
msg.chatType = message.chatType;
msg.fromUserID = message.fromUserID;
msg.fromUsername = message.fromUsername;
msg.fromColor = message.fromColor;
msg.fromTime = message.fromTime;
msg.fromTimezoneOffset = message.fromTimezoneOffset;
msg.toUserID = message.toUserID;
msg.toUsername = message.toUsername;
msg.message = message.message;
var msg:ChatMessageVO = processIncomingChatMessage(message.body.message);
var pcEvent:PrivateChatMessageEvent = new PrivateChatMessageEvent(PrivateChatMessageEvent.PRIVATE_CHAT_MESSAGE_EVENT);
pcEvent.message = msg;
@ -128,11 +106,24 @@ package org.bigbluebutton.modules.chat.services
dispatcher.dispatchEvent(pcCoreEvent);
}
private function handleChatClearPublicMessageCommand(message:Object):void {
private function handleClearPublicChatHistoryEvtMsg(message:Object):void {
LOGGER.debug("Handling clear chat history message");
var clearChatEvent:ClearPublicChatEvent = new ClearPublicChatEvent(ClearPublicChatEvent.CLEAR_PUBLIC_CHAT_EVENT);
dispatcher.dispatchEvent(clearChatEvent);
}
private function processIncomingChatMessage(rawMessage:Object):ChatMessageVO {
var msg:ChatMessageVO = new ChatMessageVO();
msg.fromUserId = rawMessage.fromUserId;
msg.fromUsername = rawMessage.fromUsername;
msg.fromColor = rawMessage.fromColor;
msg.fromTime = rawMessage.fromTime;
msg.fromTimezoneOffset = rawMessage.fromTimezoneOffset;
msg.toUserId = rawMessage.toUserId;
msg.toUsername = rawMessage.toUsername;
msg.message = rawMessage.message;
return msg;
}
}
}

View File

@ -23,71 +23,86 @@ package org.bigbluebutton.modules.chat.services
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.managers.ConnectionManager;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
public class MessageSender
{
private static const LOGGER:ILogger = getClassLogger(MessageSender);
private static const LOGGER:ILogger = getClassLogger(MessageSender);
public var dispatcher:IEventDispatcher;
public function getPublicChatMessages():void
{
public function getPublicChatMessages():void {
LOGGER.debug("Sending [chat.getPublicMessages] to server.");
var message:Object = {
header: {name: "GetChatHistoryReqMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()},
body: {}
};
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage("chat.sendPublicChatHistory",
_nc.sendMessage2x(
function(result:String):void { // On successful result
LOGGER.debug(result);
},
function(status:String):void { // status - On error occurred
LOGGER.error(status);
}
);
}
public function sendPublicMessage(message:ChatMessageVO):void
{
LOGGER.debug("Sending [chat.sendPublicMessage] to server. [{0}]", [message.message]);
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage("chat.sendPublicMessage",
function(result:String):void { // On successful result
LOGGER.debug(result);
},
function(status:String):void { // status - On error occurred
LOGGER.error(status);
},
message.toObj()
);
}
public function sendPrivateMessage(message:ChatMessageVO):void
{
LOGGER.debug("Sending [chat.sendPrivateMessage] to server.");
LOGGER.debug("Sending fromUserID [{0}] to toUserID [{1}]", [message.fromUserID, message.toUserID]);
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage("chat.sendPrivateMessage",
function(result:String):void { // On successful result
LOGGER.debug(result);
},
function(status:String):void { // status - On error occurred
LOGGER.error(status);
},
message.toObj()
);
}
public function clearPublicChatMessages():void
{
LOGGER.debug("Sending [chat.clearPublicChatMessages] to server.");
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage("chat.clearPublicChatMessages",
function(result:String):void { // On successful result
LOGGER.debug(result);
},
function(status:String):void { // status - On error occurred
LOGGER.error(status);
}
},
JSON.stringify(message)
);
}
public function sendPublicMessage(cm:ChatMessageVO):void {
LOGGER.debug("Sending [chat.sendPublicMessage] to server. [{0}]", [cm.message]);
var message:Object = {
header: {name: "SendPublicMessagePubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()},
body: {message: cm}
};
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
LOGGER.error(status);
},
JSON.stringify(message)
);
}
public function sendPrivateMessage(cm:ChatMessageVO):void {
LOGGER.debug("Sending [chat.sendPrivateMessage] to server.");
LOGGER.debug("Sending fromUserID [{0}] to toUserID [{1}]", [cm.fromUserId, cm.toUserId]);
var message:Object = {
header: {name: "SendPrivateMessagePubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()},
body: {message: cm}
};
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
LOGGER.error(status);
},
JSON.stringify(message)
);
}
public function clearPublicChatMessages():void {
LOGGER.debug("Sending [chat.clearPublicChatMessages] to server.");
var message:Object = {
header: {name: "ClearPublicChatHistoryPubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()},
body: {}
};
var _nc:ConnectionManager = BBB.initConnectionManager();
_nc.sendMessage2x(
function(result:String):void { // On successful result
},
function(status:String):void { // status - On error occurred
LOGGER.error(status);
},
JSON.stringify(message)
);
}
}

View File

@ -103,15 +103,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
if (!usersList.visible || !usersList.enabled) return;
var chatWithUserID:String = usersList.selectedItem.userID;
var chatWithIntId:String = usersList.selectedItem.intId;
// Don't want to be chatting with ourself.
if (UsersUtil.isMe(chatWithUserID)) return;
if (UsersUtil.isMe(chatWithIntId)) return;
usersList.selectedIndex = -1;
var e:CoreEvent = new CoreEvent(EventConstants.START_PRIVATE_CHAT);
e.message.chatWith = chatWithUserID;
e.message.chatWith = chatWithIntId;
var gd:Dispatcher = new Dispatcher();
gd.dispatchEvent(e);

View File

@ -49,7 +49,7 @@ package org.bigbluebutton.modules.chat.views
//sovled on forum by Flex HarUI
measuredHeight = measureHeightOfItems() + viewMetrics.top + viewMetrics.bottom;
dispatchEvent(new ChatEvent(ChatEvent.RESIZE_CHAT_TOOLBAR));
//dispatchEvent(new ChatEvent(ChatEvent.RESIZE_CHAT_TOOLBAR));
}
public function scrollToBottom():void {

View File

@ -52,6 +52,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{ChatOptionsEvent.CHANGE_FONT_SIZE}" method="changeFontSize" />
<mate:Listener type="{PrivateChatMessageEvent.PRIVATE_CHAT_MESSAGE_EVENT}" method="handlePrivateChatMessageEvent"/>
<mate:Listener type="{PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT}" method="handlePublicChatMessageEvent"/>
<mate:Listener type="{ChatHistoryEvent.RECEIVED_HISTORY}" method="handleRecievedChatHistoryEvent" />
<mate:Listener type="{ClearPublicChatEvent.CLEAR_PUBLIC_CHAT_EVENT}" method="handleClearPublicChatBoxMessages"/>
<mate:Listener type="{ShortcutEvent.FOCUS_CHAT_INPUT}" method="focusChatInput" />
<mate:Listener type="{UserLeftEvent.LEFT}" method="handleUserLeftEvent"/>
@ -90,13 +91,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.chat.ChatConstants;
import org.bigbluebutton.modules.chat.ChatUtil;
import org.bigbluebutton.modules.chat.events.ChatEvent;
import org.bigbluebutton.modules.chat.events.ChatHistoryEvent;
import org.bigbluebutton.modules.chat.events.ChatOptionsEvent;
import org.bigbluebutton.modules.chat.events.ClearPublicChatEvent;
import org.bigbluebutton.modules.chat.events.PrivateChatMessageEvent;
import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent;
import org.bigbluebutton.modules.chat.events.SendPrivateChatMessageEvent;
import org.bigbluebutton.modules.chat.events.SendPublicChatMessageEvent;
import org.bigbluebutton.modules.chat.events.TranscriptEvent;
import org.bigbluebutton.modules.chat.model.ChatConversation;
import org.bigbluebutton.modules.chat.model.ChatOptions;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
@ -141,9 +142,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
[Bindable]
private var chatListHeight:Number = 100;
[Bindable]
private var chatToolbarHeight:Number = 80;
[Bindable] public var chatOptions:ChatOptions;
private var shiftPressed:Boolean = false;
@ -270,7 +268,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function loadChatHistory(event:TimerEvent):void {
if (publicChat) {
var disp:Dispatcher = new Dispatcher();
disp.dispatchEvent(new TranscriptEvent(TranscriptEvent.LOAD_TRANSCRIPT));
disp.dispatchEvent(new ChatHistoryEvent(ChatHistoryEvent.REQUEST_HISTORY));
}
}
@ -301,13 +299,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var SPACE:String = " ";
private function displayUserHasLeftMessage():void {
var msg:ChatMessageVO = new ChatMessageVO();
msg.chatType = ChatConstants.PUBLIC_CHAT;
msg.fromUserID = SPACE;
msg.fromUserId = SPACE;
msg.fromUsername = SPACE;
msg.fromColor = "0";
msg.fromTime = new Date().getTime();
msg.fromTimezoneOffset = new Date().getTimezoneOffset();
msg.toUserID = SPACE;
msg.toUserId = SPACE;
msg.toUsername = SPACE;
msg.message = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.private.userLeft')+"</b></i>";
@ -316,13 +313,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function displayUserHasJoinedMessage():void {
var msg:ChatMessageVO = new ChatMessageVO();
msg.chatType = ChatConstants.PUBLIC_CHAT;
msg.fromUserID = SPACE;
msg.fromUserId = SPACE;
msg.fromUsername = SPACE;
msg.fromColor = "0";
msg.fromTime = new Date().getTime();
msg.fromTimezoneOffset = new Date().getTimezoneOffset();
msg.toUserID = SPACE;
msg.toUserId = SPACE;
msg.toUsername = SPACE;
msg.message = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.private.userJoined')+"</b></i>";
@ -337,9 +333,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void {
if (publicChat) {
chatMessages.newChatMessage(event.message);
if (!event.history) {
scrollToEndOfMessage();
}
scrollToEndOfMessage();
}
}
private function handleRecievedChatHistoryEvent(event:ChatHistoryEvent):void {
if (publicChat && event.history != null) {
chatMessages.processChatHistory(event.history);
scrollToEndOfMessage();
}
}
@ -352,8 +353,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
var message:ChatMessageVO = event.message;
if (!publicChat &&
( (message.fromUserID == chatWithUserID && UsersUtil.isMe(message.toUserID)) ||
(message.toUserID == chatWithUserID && UsersUtil.isMe(message.fromUserID)) )) {
( (message.fromUserId == chatWithUserID && UsersUtil.isMe(message.toUserId)) ||
(message.toUserId == chatWithUserID && UsersUtil.isMe(message.fromUserId)) )) {
chatMessages.newChatMessage(event.message);
scrollToEndOfMessage();
}
@ -368,13 +369,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
var keyCombo:String = modifier + String.fromCharCode(int(ResourceUtil.getInstance().getString('bbb.shortcutkey.chat.closePrivate')));
var msg:ChatMessageVO = new ChatMessageVO();
msg.chatType = ChatConstants.PUBLIC_CHAT;
msg.fromUserID = SPACE;
msg.fromUserId = SPACE;
msg.fromUsername = SPACE;
msg.fromColor = "0";
msg.fromTime = new Date().getTime();
msg.fromTimezoneOffset = new Date().getTimezoneOffset();
msg.toUserID = SPACE;
msg.toUserId = SPACE;
msg.toUsername = SPACE;
msg.message = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.private.closeMessage', [keyCombo])+"</b></i>";
@ -483,8 +483,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
} else {
var publicEvent:SendPublicChatMessageEvent = new SendPublicChatMessageEvent(SendPublicChatMessageEvent.SEND_PUBLIC_CHAT_MESSAGE_EVENT);
var cm:ChatMessageVO = new ChatMessageVO();
cm.chatType = ChatConstants.PUBLIC_CHAT;
cm.fromUserID = UsersUtil.getMyUserID();
cm.fromUserId = UsersUtil.getMyUserID();
cm.fromUsername = UsersUtil.getMyUsername();
// get the color value from ColorPicker
cm.fromColor = cmpColorPicker.selectedColor.toString();
@ -505,8 +504,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function sendPrivateChatMessage(message:String):void {
var privateEvent:SendPrivateChatMessageEvent = new SendPrivateChatMessageEvent(SendPrivateChatMessageEvent.SEND_PRIVATE_CHAT_MESSAGE_EVENT);
var cm:ChatMessageVO = new ChatMessageVO();
cm.chatType = ChatConstants.PRIVATE_CHAT;
cm.fromUserID = UsersUtil.getMyUserID();
cm.fromUserId = UsersUtil.getMyUserID();
cm.fromUsername = UsersUtil.getMyUsername();
// get the color value from ColorPicker
cm.fromColor = cmpColorPicker.selectedColor.toString();
@ -519,7 +517,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
//cm.message = ChatUtil.parseURLs(ChatUtil.cleanup(message));
cm.message = ExternalInterface.call('parseURLs', (ChatUtil.cleanup(message)));
cm.toUserID = chatWithUserID;
cm.toUserId = chatWithUserID;
cm.toUsername = chatWithUsername;
privateEvent.chatMessage = cm;
@ -645,17 +643,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
const paddingHeight:int = 5;
const paddingWidth:int = 5;
chatToolbar.width = 45;
chatToolbar.x = (chatMessagesCanvas.width - chatToolbar.width) - 10;
chatToolbar.x = (chatMessagesCanvas.width - chatToolbar.width) - 20;
chatToolbar.y = 10;
if (!publicChat) {
chatToolbar.publicChat = false;
}
if(chatMessagesList.mx_internal::scroll_verticalScrollBar != null && chatMessagesList.mx_internal::scroll_verticalScrollBar.visible){
chatToolbar.width -= chatMessagesList.mx_internal::scroll_verticalScrollBar.width;
}
}
]]>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
This program is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 3.0 of the License, or (at your option) any later
version.
BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<mx:ControlBar xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="10%" styleName="chatControlBarStyle">
<mx:TextArea id="txtMsg" width="100%" color="{cmpColorPicker.selectedColor}"
styleName="chatControlBarTextMsgStyle" toolTip="{ResourceUtil.getInstance().getString('bbb.accessibility.chat.chatwindow.input')}"/>
<mx:ColorPicker id="cmpColorPicker" showTextField="false" toolTip="{ResourceUtil.getInstance().getString('bbb.chat.cmpColorPicker.toolTip')}"
selectedColor="0x000000" dataProvider="{chatView.colorPickerColours}" swatchPanelStyleName="chatColorPickerStyle"/>
<mx:Button label="{ResourceUtil.getInstance().getString('bbb.chat.sendBtn')}" id="sendBtn" styleName="chatSendButtonStyle"
toolTip="{ResourceUtil.getInstance().getString('bbb.chat.sendBtn.toolTip')}" click="chatView.sendMessages()"/>
</mx:ControlBar>

View File

@ -10,6 +10,7 @@
visible="{toolbarVisible}"
styleName="chatToolbarStyle"
horizontalAlign="center"
width="28"
hideEffect="{fadeOut}" showEffect="{fadeIn}"
backgroundColor="{bgColor}">

View File

@ -167,7 +167,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void {
notifyUserOfNewMessage(PUBLIC_CHAT_USERID);
if (!UsersUtil.isMe(event.message.fromUserID)) {
if (!UsersUtil.isMe(event.message.fromUserId)) {
publicNotification();
}
}
@ -175,17 +175,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handlePrivateChatMessageEvent(event:PrivateChatMessageEvent):void {
// This message is from me. Ignore as a chatbox has already been created for this
// private chat and that chatbox will handle this message.
if (UsersUtil.isMe(event.message.fromUserID)) return;
if (UsersUtil.isMe(event.message.fromUserId)) return;
// I received a new private chat. Open up a new chatbox and forward the message
// to the chatbox. Succeeding messages will be handled by that chatbox.
if (! userHasChatBox(event.message.fromUserID)) {
if (! userHasChatBox(event.message.fromUserId)) {
// Open a private chat tab.
openChatBoxFor(event.message.fromUserID, false).handleFirstPrivateMessage(event);
openChatBoxFor(event.message.fromUserId, false).handleFirstPrivateMessage(event);
}
// See if the chatbox is not in focus and notify user about the message.
notifyUserOfNewMessage(event.message.fromUserID);
notifyUserOfNewMessage(event.message.fromUserId);
privateNotification(event);
}
@ -344,7 +344,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
// Activates an audio alert for screen-reader users on private message reception
private function privateNotification(event:PrivateChatMessageEvent):void{
if (! UsersUtil.isMe(event.message.fromUserID)) {
if (! UsersUtil.isMe(event.message.fromUserId)) {
playSound();
}
}

View File

@ -26,7 +26,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.util.i18n.ResourceUtil;
]]>
</fx:Script>
<!-- No 'me' property on the User2x class -->
<!--
<mx:Label id="nameLabel" textAlign="left" text="{data.name} {data.me ? '(' + ResourceUtil.getInstance().getString('bbb.users.usersGrid.nameItemRenderer.youIdentifier') + ')' : ''}"
fontWeight="{data.me ? 'bold' : 'normal'}"
color="{data.me ? 0x003399 : 0x000000}"/>
-->
<mx:Label id="nameLabel" textAlign="left" text="{data.name}"
fontWeight="{'normal'}"
color="{0x000000}"/>
</mx:HBox>

View File

@ -18,41 +18,22 @@
*/
package org.bigbluebutton.modules.chat.vo
{
public class ChatMessageVO {
// The type of chat (PUBLIC or PRIVATE)
public var chatType:String;
public class ChatMessageVO {
// The sender
public var fromUserID:String;
public var fromUserId:String;
public var fromUsername:String;
public var fromColor:String;
// Store the UTC time when the message was sent.
public var fromTime:Number;
public var fromTime:Number;
// Stores the timezone offset (in minutes) when the message was
// sent. This is used by the receiver to convert to locale time.
public var fromTimezoneOffset:Number;
// The receiver.
public var toUserID:String = "public_chat_userid";
public var toUserId:String = "public_chat_userid";
public var toUsername:String = "public_chat_username";
public var message:String;
public function toObj():Object {
var m:Object = new Object();
m.chatType = chatType;
m.fromUserID = fromUserID;
m.fromUsername = fromUsername;
m.fromColor = fromColor;
m.fromTime = fromTime;
m.fromTimezoneOffset = fromTimezoneOffset;
m.message = message;
m.toUserID = toUserID;
m.toUsername = toUsername;
return m;
}
}
public var message:String;
}
}

View File

@ -84,19 +84,17 @@ package org.bigbluebutton.modules.polling.service
}
var pollResultMessage:ChatMessageVO = new ChatMessageVO();
pollResultMessage.chatType = ChatConstants.PUBLIC_CHAT;
pollResultMessage.fromUserID = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage");
pollResultMessage.fromUserId = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage");
pollResultMessage.fromUsername = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage");
pollResultMessage.fromColor = "86187";
pollResultMessage.fromTime = new Date().getTime();
pollResultMessage.fromTimezoneOffset = new Date().getTimezoneOffset();
pollResultMessage.toUserID = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage");
pollResultMessage.toUserId = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage");
pollResultMessage.toUsername = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage");
pollResultMessage.message = accessibleAnswers;
var pollResultMessageEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
pollResultMessageEvent.message = pollResultMessage;
pollResultMessageEvent.history = false;
dispatcher.dispatchEvent(pollResultMessageEvent);
}
}