remove all 1.1 chat messaging code

This commit is contained in:
Chad Pilkey 2017-07-07 20:16:14 -04:00
parent 550b880db7
commit bf9f6df9b1
29 changed files with 10 additions and 1138 deletions

View File

@ -102,13 +102,6 @@ public interface IBigBlueButtonInGW {
boolean lock, boolean viewersOnly,
String layout);
// Chat
void getAllChatHistory(String meetingID, String requesterID, String replyTo);
void getChatHistory(String meetingID, String requesterID, String replyTo, String chatId);
void sendPublicMessage(String meetingID, String requesterID, Map<String, String> message);
void sendPrivateMessage(String meetingID, String requesterID, Map<String, String> message);
void clearPublicChatHistory(String meetingID, String requesterID);
// DeskShare
void deskShareStarted(String confId, String callerId, String callerIdName);
void deskShareStopped(String conferenceName, String callerId, String callerIdName);

View File

@ -1,49 +0,0 @@
package org.bigbluebutton.core.pubsub.receivers;
import org.bigbluebutton.common.messages.GetChatHistoryRequestMessage;
import org.bigbluebutton.common.messages.MessagingConstants;
import org.bigbluebutton.common.messages.SendPrivateChatMessage;
import org.bigbluebutton.common.messages.SendPublicChatMessage;
import org.bigbluebutton.common.messages.ClearPublicChatHistoryRequestMessage;
import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
import org.bigbluebutton.core.api.IBigBlueButtonInGW;
public class ChatMessageReceiver implements MessageHandler{
private IBigBlueButtonInGW bbbGW;
public ChatMessageReceiver(IBigBlueButtonInGW bbbGW) {
this.bbbGW = bbbGW;
}
@Override
public void handleMessage(String pattern, String channel, String message) {
if (channel.equalsIgnoreCase(MessagingConstants.TO_CHAT_CHANNEL)) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (GetChatHistoryRequestMessage.GET_CHAT_HISTORY_REQUEST.equals(messageName)) {
GetChatHistoryRequestMessage msg = GetChatHistoryRequestMessage.fromJson(message);
// TODO: Add chatId to getChatHistory message
bbbGW.getChatHistory(msg.meetingId, msg.requesterId, msg.replyTo, "FIXME!");
} else if (SendPublicChatMessage.SEND_PUBLIC_CHAT_MESSAGE.equals(messageName)){
SendPublicChatMessage msg = SendPublicChatMessage.fromJson(message);
bbbGW.sendPublicMessage(msg.meetingId, msg.requesterId, msg.messageInfo);
} else if (SendPrivateChatMessage.SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)){
SendPrivateChatMessage msg = SendPrivateChatMessage.fromJson(message);
bbbGW.sendPrivateMessage(msg.meetingId, msg.requesterId, msg.messageInfo);
} else if (ClearPublicChatHistoryRequestMessage.CLEAR_PUBLIC_CHAT_HISTORY_REQUEST.equals(messageName)){
ClearPublicChatHistoryRequestMessage msg = ClearPublicChatHistoryRequestMessage.fromJson(message);
bbbGW.clearPublicChatHistory(msg.meetingId, msg.requesterId);
}
}
}
}
}
}

View File

@ -31,9 +31,6 @@ public class RedisMessageReceiver {
}
private void setupReceivers() {
ChatMessageReceiver chatRx = new ChatMessageReceiver(bbbGW);
receivers.add(chatRx);
LockMessageReceiver lockRx = new LockMessageReceiver(bbbGW);
receivers.add(lockRx);

View File

@ -314,7 +314,7 @@ class BigBlueButtonActor(val system: ActorSystem,
eventBus.publish(BigBlueButtonEvent(id, new GetPresentationInfo(id, html5clientRequesterID, html5clientRequesterID)))
//send chat history
eventBus.publish(BigBlueButtonEvent(id, new GetAllChatHistoryRequest(id, html5clientRequesterID, html5clientRequesterID)))
//eventBus.publish(BigBlueButtonEvent(id, new GetAllChatHistoryRequest(id, html5clientRequesterID, html5clientRequesterID)))
//send lock settings
eventBus.publish(BigBlueButtonEvent(id, new GetLockSettings(id, html5clientRequesterID)))

View File

@ -412,33 +412,6 @@ class BigBlueButtonInGW(
}
/**
* *******************************************************************
* Message Interface for Chat
* *****************************************************************
*/
def getAllChatHistory(meetingID: String, requesterID: String, replyTo: String) {
eventBus.publish(BigBlueButtonEvent(meetingID, new GetAllChatHistoryRequest(meetingID, requesterID, replyTo)))
}
def getChatHistory(meetingID: String, requesterID: String, replyTo: String, chatId: String) {
eventBus.publish(BigBlueButtonEvent(meetingID, new GetChatHistoryRequest(meetingID, requesterID, replyTo, chatId)))
}
def sendPublicMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) {
// Convert java Map to Scala Map, then convert Mutable map to immutable map
eventBus.publish(BigBlueButtonEvent(meetingID, new SendPublicMessageRequest(meetingID, requesterID, JavaConverters.mapAsScalaMap(message).toMap)))
}
def sendPrivateMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) {
eventBus.publish(BigBlueButtonEvent(meetingID, new SendPrivateMessageRequest(meetingID, requesterID, JavaConverters.mapAsScalaMap(message).toMap)))
}
def clearPublicChatHistory(meetingID: String, requesterID: String) {
eventBus.publish(BigBlueButtonEvent(meetingID, new ClearPublicChatHistoryRequest(meetingID, requesterID)))
}
/**
* *******************************************************************
* Message Interface for Voice

View File

@ -8,7 +8,6 @@ import akka.actor.SupervisorStrategy.Resume
import java.io.{ PrintWriter, StringWriter }
import org.bigbluebutton.core.api._
import org.bigbluebutton.common.messages.MessagingConstants
import org.bigbluebutton.core.pubsub.senders.ChatMessageToJsonConverter
import org.bigbluebutton.common.messages.StartRecordingVoiceConfRequestMessage
import org.bigbluebutton.common.messages.StopRecordingVoiceConfRequestMessage
import org.bigbluebutton.core.pubsub.senders.MeetingMessageToJsonConverter
@ -55,10 +54,6 @@ class MessageSenderActor(val service: MessageSender)
val encoder = new ToJsonEncoder()
def receive = {
case msg: UserEjectedFromMeeting => handleUserEjectedFromMeeting(msg)
case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg)
case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg)
case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg)
case msg: ClearPublicChatHistoryReply => handleClearPublicChatHistoryReply(msg)
case msg: MeetingCreated => handleMeetingCreated(msg)
case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg)
case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg)
@ -178,26 +173,6 @@ class MessageSenderActor(val service: MessageSender)
service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, json)
}
private def handleGetChatHistoryReply(msg: GetChatHistoryReply) {
val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg)
service.send(MessagingConstants.FROM_CHAT_CHANNEL, json)
}
private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) {
val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg)
service.send(MessagingConstants.FROM_CHAT_CHANNEL, json)
}
private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) {
val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg)
service.send(MessagingConstants.FROM_CHAT_CHANNEL, json)
}
private def handleClearPublicChatHistoryReply(msg: ClearPublicChatHistoryReply) {
val json = ChatMessageToJsonConverter.clearPublicChatHistoryReplyToJson(msg)
service.send(MessagingConstants.FROM_CHAT_CHANNEL, json)
}
private def handleStartRecordingVoiceConf(msg: StartRecordingVoiceConf) {
val m = new StartRecordingVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId)
service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, m.toJson())

View File

@ -94,14 +94,9 @@ case class ActivityResponse(meetingID: String) extends InMessage
case class LogoutEndMeeting(meetingID: String, userID: String) extends InMessage
//////////////////////////////////////////////////////////////////////////////////
// Chat
// Global Audio
/////////////////////////////////////////////////////////////////////////////////
case class GetAllChatHistoryRequest(meetingID: String, requesterID: String, replyTo: String) extends InMessage
case class GetChatHistoryRequest(meetingID: String, requesterID: String, replyTo: String, chatId: String) extends InMessage
case class SendPublicMessageRequest(meetingID: String, requesterID: String, message: Map[String, String]) extends InMessage
case class SendPrivateMessageRequest(meetingID: String, requesterID: String, message: Map[String, String]) extends InMessage
case class ClearPublicChatHistoryRequest(meetingID: String, requesterID: String) extends InMessage
case class UserConnectedToGlobalAudio(meetingID: String, /** Not used. Just to satisfy trait **/ voiceConf: String,
userid: String, name: String) extends InMessage
case class UserDisconnectedFromGlobalAudio(meetingID: String, /** Not used. Just to satisfy trait **/ voiceConf: String,

View File

@ -80,15 +80,6 @@ case class StartRecordingVoiceConf(meetingID: String, recorded: Boolean, voiceCo
case class StopRecordingVoiceConf(meetingID: String, recorded: Boolean, voiceConfId: String, recordedStream: String) extends IOutMessage
case class StopRecording(meetingID: String, recorded: Boolean, requesterID: String) extends IOutMessage
// Chat
case class GetChatHistoryReply(meetingID: String, recorded: Boolean, requesterID: String,
replyTo: String, history: Array[Map[String, String]]) extends IOutMessage
case class SendPublicMessageEvent(meetingID: String, recorded: Boolean, requesterID: String,
message: Map[String, String]) extends IOutMessage
case class SendPrivateMessageEvent(meetingID: String, recorded: Boolean, requesterID: String,
message: Map[String, String]) extends IOutMessage
case class ClearPublicChatHistoryReply(meetingID: String, recorded: Boolean, requesterID: String) extends IOutMessage
// Layout
case class GetCurrentLayoutReply(meetingID: String, recorded: Boolean, requesterID: String, layoutID: String,
locked: Boolean, setByUserID: String) extends IOutMessage

View File

@ -1,36 +0,0 @@
package org.bigbluebutton.core.apps
import org.bigbluebutton.common2.domain.DefaultProps
import org.bigbluebutton.core.api._
import org.bigbluebutton.core.running.LiveMeeting
import org.bigbluebutton.core.{ OutMessageGateway }
trait ChatApp {
val props: DefaultProps
val liveMeeting: LiveMeeting
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))
}
def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) {
//liveMeeting.chatModel.addNewChatMessage(msg.message)
val pubMsg = msg.message
outGW.send(new SendPublicMessageEvent(props.meetingProp.intId, props.recordProp.record, msg.requesterID, pubMsg))
}
def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) {
val privMsg = msg.message
outGW.send(new SendPrivateMessageEvent(props.meetingProp.intId, props.recordProp.record, msg.requesterID, privMsg))
}
def handleClearPublicChatHistoryRequest(msg: ClearPublicChatHistoryRequest) {
//liveMeeting.chatModel.clearPublicChatHistory()
outGW.send(new ClearPublicChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID))
}
}

View File

@ -1,72 +0,0 @@
package org.bigbluebutton.core.pubsub.senders
import org.bigbluebutton.core.api._
import scala.collection.mutable.HashMap
import java.util.ArrayList
import org.bigbluebutton.core.messaging.Util
import org.bigbluebutton.common.messages.ChatKeyUtil
import scala.collection.JavaConverters
object ChatMessageToJsonConverter {
val UNKNOWN = "unknown"
private def chatMessageToMap(msg: Map[String, String]): HashMap[String, String] = {
val res = new HashMap[String, String]
res += "chat_type" -> msg.get(ChatKeyUtil.CHAT_TYPE).getOrElse(UNKNOWN)
res += "from_userid" -> msg.get(ChatKeyUtil.FROM_USERID).getOrElse(UNKNOWN)
res += "from_username" -> msg.get(ChatKeyUtil.FROM_USERNAME).getOrElse(UNKNOWN)
res += "from_color" -> msg.get(ChatKeyUtil.FROM_COLOR).getOrElse(UNKNOWN)
res += "from_time" -> msg.get(ChatKeyUtil.FROM_TIME).getOrElse(UNKNOWN)
res += "from_tz_offset" -> msg.get(ChatKeyUtil.FROM_TZ_OFFSET).getOrElse(UNKNOWN)
res += "to_userid" -> msg.get(ChatKeyUtil.TO_USERID).getOrElse(UNKNOWN)
res += "to_username" -> msg.get(ChatKeyUtil.TO_USERNAME).getOrElse(UNKNOWN)
res += "message" -> msg.get(ChatKeyUtil.MESSAGE).getOrElse(UNKNOWN)
res
}
def getChatHistoryReplyToJson(msg: GetChatHistoryReply): String = {
val payload = new java.util.HashMap[String, Any]()
payload.put(Constants.MEETING_ID, msg.meetingID)
payload.put(Constants.REQUESTER_ID, msg.requesterID)
val collection = new ArrayList[java.util.Map[String, String]]();
msg.history.foreach(p => {
collection.add(JavaConverters.mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(p)))
})
payload.put(Constants.CHAT_HISTORY, collection)
val header = Util.buildHeader(MessageNames.GET_CHAT_HISTORY_REPLY, Some(msg.replyTo))
Util.buildJson(header, payload)
}
def sendPublicMessageEventToJson(msg: SendPublicMessageEvent): String = {
val payload = new java.util.HashMap[String, Any]()
payload.put(Constants.MEETING_ID, msg.meetingID)
payload.put(Constants.MESSAGE, JavaConverters.mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message)))
val header = Util.buildHeader(MessageNames.SEND_PUBLIC_CHAT_MESSAGE, None)
Util.buildJson(header, payload)
}
def sendPrivateMessageEventToJson(msg: SendPrivateMessageEvent): String = {
val payload = new java.util.HashMap[String, Any]()
payload.put(Constants.MEETING_ID, msg.meetingID)
payload.put(Constants.MESSAGE, JavaConverters.mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message)))
val header = Util.buildHeader(MessageNames.SEND_PRIVATE_CHAT_MESSAGE, None)
Util.buildJson(header, payload)
}
def clearPublicChatHistoryReplyToJson(msg: ClearPublicChatHistoryReply): String = {
val payload = new java.util.HashMap[String, Any]()
payload.put(Constants.MEETING_ID, msg.meetingID)
payload.put(Constants.REQUESTER_ID, msg.requesterID)
val header = Util.buildHeader(MessageNames.CLEAR_PUBLIC_CHAT_HISTORY_REPLY, None)
Util.buildJson(header, payload)
}
}

View File

@ -49,7 +49,7 @@ class MeetingActor(val props: DefaultProps,
with BreakoutApp2x
with UsersApp with PresentationApp
with ChatApp with WhiteboardApp with PollApp
with WhiteboardApp with PollApp
with BreakoutRoomApp
with PermisssionCheck
with UserBroadcastCamStartMsgHdlr
@ -138,9 +138,6 @@ class MeetingActor(val props: DefaultProps,
case msg: MuteUserRequest => handleMuteUserRequest(msg)
case msg: EjectUserFromVoiceRequest => handleEjectUserRequest(msg)
case msg: TransferUserToMeetingRequest => handleTransferUserToMeeting(msg)
case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg)
case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg)
case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg)
case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg)
case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg)
case msg: InitializeMeeting => handleInitializeMeeting(msg)
@ -148,7 +145,6 @@ class MeetingActor(val props: DefaultProps,
case msg: GetRecordingStatus => handleGetRecordingStatus(msg)
case msg: GetPollRequest => handleGetPollRequest(msg)
case msg: LogoutEndMeeting => handleLogoutEndMeeting(msg)
case msg: ClearPublicChatHistoryRequest => handleClearPublicChatHistoryRequest(msg)
// Breakout rooms
case msg: BreakoutRoomsListMessage => handleBreakoutRoomsList(msg)

View File

@ -38,8 +38,8 @@ class RedisRecorderActor(val system: ActorSystem)
}
def receive = {
case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg)
case msg: ClearPublicChatHistoryReply => handleClearPublicChatHistoryReply(msg)
//case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg)
//case msg: ClearPublicChatHistoryReply => handleClearPublicChatHistoryReply(msg)
case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg)
case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg)
case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg)
@ -71,7 +71,7 @@ class RedisRecorderActor(val system: ActorSystem)
case _ => // do nothing
}
private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) {
/* private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) {
if (msg.recorded) {
val message = JavaConverters.mapAsJavaMap(msg.message)
val ev = new PublicChatRecordEvent()
@ -85,16 +85,16 @@ class RedisRecorderActor(val system: ActorSystem)
record(msg.meetingID, JavaConverters.mapAsScalaMap(ev.toMap).toMap)
}
}
}*/
private def handleClearPublicChatHistoryReply(msg: ClearPublicChatHistoryReply) {
/* private def handleClearPublicChatHistoryReply(msg: ClearPublicChatHistoryReply) {
if (msg.recorded) {
val ev = new ClearPublicChatRecordEvent()
ev.setTimestamp(TimestampGenerator.generateTimestamp())
ev.setMeetingId(msg.meetingID)
record(msg.meetingID, JavaConverters.mapAsScalaMap(ev.toMap).toMap)
}
}
}*/
private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) {

View File

@ -1,135 +0,0 @@
package org.bigbluebutton.red5.client;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.bigbluebutton.common.messages.ClearPublicChatHistoryReplyMessage;
import org.bigbluebutton.common.messages.GetChatHistoryReplyMessage;
import org.bigbluebutton.common.messages.SendPrivateChatMessage;
import org.bigbluebutton.common.messages.SendPublicChatMessage;
import org.bigbluebutton.red5.client.messaging.BroadcastClientMessage;
import org.bigbluebutton.red5.client.messaging.IConnectionInvokerService;
import org.bigbluebutton.red5.client.messaging.DirectClientMessage;
import org.bigbluebutton.red5.client.ChatKeyUtil;
import java.util.HashMap;
import java.util.Map;
public class ChatClientMessageSender {
private IConnectionInvokerService service;
public ChatClientMessageSender(IConnectionInvokerService service) {
this.service = service;
}
public void handleChatMessage(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
switch (messageName) {
case SendPublicChatMessage.SEND_PUBLIC_CHAT_MESSAGE:
SendPublicChatMessage spucm = SendPublicChatMessage.fromJson(message);
if (spucm != null) {
processSendPublicChatMessage(spucm);
}
break;
case SendPrivateChatMessage.SEND_PRIVATE_CHAT_MESSAGE:
SendPrivateChatMessage sprcm = SendPrivateChatMessage.fromJson(message);
if (sprcm != null) {
processSendPrivateChatMessage(sprcm);
}
break;
case GetChatHistoryReplyMessage.GET_CHAT_HISTORY_REPLY:
GetChatHistoryReplyMessage gch = GetChatHistoryReplyMessage.fromJson(message);
if (gch != null) {
processGetChatHistoryReply(gch);
}
break;
case ClearPublicChatHistoryReplyMessage.CLEAR_PUBLIC_CHAT_HISTORY_REPLY:
ClearPublicChatHistoryReplyMessage gcl = ClearPublicChatHistoryReplyMessage.fromJson(message);
if (gcl != null) {
processClearPublicChatHistoryReply(gcl);
}
break;
}
}
}
}
private void processSendPublicChatMessage(SendPublicChatMessage msg) {
Map<String, Object> messageInfo = new HashMap<String, Object>();
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msg.messageInfo.get(ChatKeyUtil.CHAT_TYPE));
messageInfo.put(ChatKeyUtil.FROM_USERID, msg.messageInfo.get(ChatKeyUtil.FROM_USERID));
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msg.messageInfo.get(ChatKeyUtil.FROM_USERNAME));
messageInfo.put(ChatKeyUtil.TO_USERID, msg.messageInfo.get(ChatKeyUtil.TO_USERID));
messageInfo.put(ChatKeyUtil.TO_USERNAME, msg.messageInfo.get(ChatKeyUtil.TO_USERNAME));
messageInfo.put(ChatKeyUtil.FROM_TIME, msg.messageInfo.get(ChatKeyUtil.FROM_TIME));
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msg.messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET));
messageInfo.put(ChatKeyUtil.FROM_COLOR, msg.messageInfo.get(ChatKeyUtil.FROM_COLOR));
messageInfo.put(ChatKeyUtil.MESSAGE, msg.messageInfo.get(ChatKeyUtil.MESSAGE));
BroadcastClientMessage m = new BroadcastClientMessage(msg.meetingId, "ChatReceivePublicMessageCommand", messageInfo);
service.sendMessage(m);
}
private void processSendPrivateChatMessage(SendPrivateChatMessage msg) {
Map<String, Object> messageInfo = new HashMap<String, Object>();
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msg.messageInfo.get(ChatKeyUtil.CHAT_TYPE));
messageInfo.put(ChatKeyUtil.FROM_USERID, msg.messageInfo.get(ChatKeyUtil.FROM_USERID));
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msg.messageInfo.get(ChatKeyUtil.FROM_USERNAME));
messageInfo.put(ChatKeyUtil.TO_USERID, msg.messageInfo.get(ChatKeyUtil.TO_USERID));
messageInfo.put(ChatKeyUtil.TO_USERNAME, msg.messageInfo.get(ChatKeyUtil.TO_USERNAME));
messageInfo.put(ChatKeyUtil.FROM_TIME, msg.messageInfo.get(ChatKeyUtil.FROM_TIME));
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msg.messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET));
messageInfo.put(ChatKeyUtil.FROM_COLOR, msg.messageInfo.get(ChatKeyUtil.FROM_COLOR));
messageInfo.put(ChatKeyUtil.MESSAGE, msg.messageInfo.get(ChatKeyUtil.MESSAGE));
String toUserId = msg.messageInfo.get(ChatKeyUtil.TO_USERID);
DirectClientMessage receiver = new DirectClientMessage(msg.meetingId, toUserId, "ChatReceivePrivateMessageCommand", messageInfo);
service.sendMessage(receiver);
DirectClientMessage sender = new DirectClientMessage(msg.meetingId, msg.requesterId, "ChatReceivePrivateMessageCommand", messageInfo);
service.sendMessage(sender);
}
private void processGetChatHistoryReply(GetChatHistoryReplyMessage gch) {
Map<String, Object> args = new HashMap<String, Object>();
args.put("meetingId", gch.meetingId);
args.put("requester_id", gch.requesterId);
args.put("chat_history", gch.chatHistory);
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();
message.put("msg", gson.toJson(args.get("chat_history")));
DirectClientMessage m = new DirectClientMessage(gch.meetingId, gch.requesterId, "ChatRequestMessageHistoryReply", message);
service.sendMessage(m);
}
private void processClearPublicChatHistoryReply(ClearPublicChatHistoryReplyMessage gcl) {
Map<String, Object> args = new HashMap<String, Object>();
args.put("meetingId", gcl.meetingId);
args.put("requester_id", gcl.requesterId);
Map<String, Object> message = new HashMap<String, Object>();
Gson gson = new Gson();
message.put("msg", gson.toJson(args));
BroadcastClientMessage m = new BroadcastClientMessage(gcl.meetingId, "ChatClearPublicMessageCommand", message);
service.sendMessage(m);
}
}

View File

@ -1,13 +0,0 @@
package org.bigbluebutton.red5.client;
public class ChatKeyUtil {
public static final String CHAT_TYPE = "chatType";
public static final String FROM_USERID = "fromUserID";
public static final String FROM_USERNAME = "fromUsername";
public static final String FROM_COLOR = "fromColor";
public static final String FROM_TIME = "fromTime";
public static final String FROM_TZ_OFFSET = "fromTimezoneOffset";
public static final String TO_USERID = "toUserID";
public static final String TO_USERNAME = "toUsername";
public static final String MESSAGE = "message";
}

View File

@ -1,13 +0,0 @@
package org.bigbluebutton.common.messages;
public class ChatKeyUtil {
public static final String CHAT_TYPE = "chatType";
public static final String FROM_USERID = "fromUserID";
public static final String FROM_USERNAME = "fromUsername";
public static final String FROM_COLOR = "fromColor";
public static final String FROM_TIME = "fromTime";
public static final String FROM_TZ_OFFSET = "fromTimezoneOffset";
public static final String TO_USERID = "toUserID";
public static final String TO_USERNAME = "toUsername";
public static final String MESSAGE = "message";
}

View File

@ -1,51 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ClearPublicChatHistoryReplyMessage implements ISubscribedMessage {
public static final String CLEAR_PUBLIC_CHAT_HISTORY_REPLY = "clear_public_chat_history_reply";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public ClearPublicChatHistoryReplyMessage(String meetingId, String requesterId) {
this.meetingId = meetingId;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(CLEAR_PUBLIC_CHAT_HISTORY_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static ClearPublicChatHistoryReplyMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (CLEAR_PUBLIC_CHAT_HISTORY_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
return new ClearPublicChatHistoryReplyMessage(meetingId, requesterId);
}
}
}
}
return null;
}
}

View File

@ -1,52 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class ClearPublicChatHistoryRequestMessage implements IBigBlueButtonMessage {
public static final String CLEAR_PUBLIC_CHAT_HISTORY_REQUEST = "clear_public_chat_history_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public ClearPublicChatHistoryRequestMessage(String meetingId, String requesterId) {
this.meetingId = meetingId;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REQUESTER_ID, requesterId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(CLEAR_PUBLIC_CHAT_HISTORY_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static ClearPublicChatHistoryRequestMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (CLEAR_PUBLIC_CHAT_HISTORY_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
return new ClearPublicChatHistoryRequestMessage(meetingId, requesterId);
}
}
}
}
return null;
}
}

View File

@ -1,57 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetChatHistory implements IBigBlueButtonMessage {
public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String replyTo;
public final String requesterId;
public GetChatHistory(String meetingId, String requesterId, String replyTo) {
this.meetingId = meetingId;
this.replyTo = replyTo;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REPLY_TO, replyTo);
payload.put(Constants.REQUESTER_ID, requesterId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetChatHistory fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (GET_CHAT_HISTORY_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REPLY_TO)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
return new GetChatHistory(meetingId, replyTo, requesterId);
}
}
}
}
return null;
}
}

View File

@ -1,65 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetChatHistoryReplyMessage implements ISubscribedMessage {
public static final String GET_CHAT_HISTORY_REPLY = "get_chat_history_reply";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final ArrayList<Map<String, Object>> chatHistory;
public GetChatHistoryReplyMessage(String meetingId, String requesterId, ArrayList<Map<String, Object>> chatHistory) {
this.meetingId = meetingId;
this.chatHistory = chatHistory;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.CHAT_HISTORY, chatHistory);
payload.put(Constants.REQUESTER_ID, requesterId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REPLY, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetChatHistoryReplyMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (GET_CHAT_HISTORY_REPLY.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.CHAT_HISTORY)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
JsonArray history = (JsonArray) payload.get(Constants.CHAT_HISTORY);
Util util = new Util();
ArrayList<Map<String, Object>> chatHistory = util.extractChatHistory(history);
return new GetChatHistoryReplyMessage(meetingId, requesterId, chatHistory);
}
}
}
}
return null;
}
}

View File

@ -1,56 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class GetChatHistoryRequestMessage implements IBigBlueButtonMessage {
public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String replyTo;
public final String requesterId;
public GetChatHistoryRequestMessage(String meetingId, String requesterId, String replyTo) {
this.meetingId = meetingId;
this.replyTo = replyTo;
this.requesterId = requesterId;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put(Constants.MEETING_ID, meetingId);
payload.put(Constants.REPLY_TO, replyTo);
payload.put(Constants.REQUESTER_ID, requesterId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static GetChatHistoryRequestMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (GET_CHAT_HISTORY_REQUEST.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.REPLY_TO)
&& payload.has(Constants.REQUESTER_ID)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
String replyTo = payload.get(Constants.REPLY_TO).getAsString();
String requesterId = payload.get(Constants.REQUESTER_ID).getAsString();
return new GetChatHistoryRequestMessage(meetingId, requesterId, replyTo);
}
}
}
}
return null;
}
}

View File

@ -27,7 +27,6 @@ public class MessagingConstants {
public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation";
public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling";
public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users";
public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat";
public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard";
public static final String FROM_DESK_SHARE_CHANNEL = FROM_BBB_APPS_CHANNEL + ":deskshare";
@ -38,7 +37,6 @@ public class MessagingConstants {
public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation";
public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling";
public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users";
public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat";
public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice";
public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard";

View File

@ -1,115 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendPrivateChatMessage implements IBigBlueButtonMessage {
public static final String SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final Map<String, String> messageInfo;
public SendPrivateChatMessage(String meetingId, String requesterId,
Map<String, String> message) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.messageInfo = message;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
Map<String, String> message = new HashMap<String, String>();
message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE));
message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE));
message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME));
message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET));
message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR));
message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID));
message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID));
message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME));
message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME));
payload.put(Constants.MESSAGE, message);
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_PRIVATE_CHAT_MESSAGE, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static SendPrivateChatMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject();
Map<String, String> messageInfo = new HashMap<String, String>();
if (msgObj.has(ChatKeyUtil.CHAT_TYPE)
&& msgObj.has(ChatKeyUtil.MESSAGE)
&& msgObj.has(ChatKeyUtil.TO_USERNAME)
&& msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET)
&& msgObj.has(ChatKeyUtil.FROM_COLOR)
&& msgObj.has(ChatKeyUtil.TO_USERID)
&& msgObj.has(ChatKeyUtil.FROM_USERID)
&& msgObj.has(ChatKeyUtil.FROM_TIME)
&& msgObj.has(ChatKeyUtil.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
return new SendPrivateChatMessage(meetingId, requesterId, messageInfo);
} else if (msgObj.has(Constants.CHAT_TYPE)
&& msgObj.has(Constants.MESSAGE)
&& msgObj.has(Constants.TO_USERNAME)
&& msgObj.has(Constants.FROM_TZ_OFFSET)
&& msgObj.has(Constants.FROM_COLOR)
&& msgObj.has(Constants.TO_USERID)
&& msgObj.has(Constants.FROM_USERID)
&& msgObj.has(Constants.FROM_TIME)
&& msgObj.has(Constants.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
return new SendPrivateChatMessage(meetingId, requesterId, messageInfo);
}
}
}
}
}
return null;
}
}

View File

@ -1,115 +0,0 @@
package org.bigbluebutton.common.messages;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class SendPublicChatMessage implements IBigBlueButtonMessage {
public static final String SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message";
public static final String VERSION = "0.0.1";
public final String meetingId;
public final String requesterId;
public final Map<String, String> messageInfo;
public SendPublicChatMessage(String meetingId, String requesterId,
Map<String, String> message) {
this.meetingId = meetingId;
this.requesterId = requesterId;
this.messageInfo = message;
}
public String toJson() {
HashMap<String, Object> payload = new HashMap<String, Object>();
Map<String, String> message = new HashMap<String, String>();
message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE));
message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE));
message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME));
message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET));
message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR));
message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID));
message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID));
message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME));
message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME));
payload.put(Constants.MESSAGE, message);
payload.put(Constants.MEETING_ID, meetingId);
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(SEND_PUBLIC_CHAT_MESSAGE, VERSION, null);
return MessageBuilder.buildJson(header, payload);
}
public static SendPublicChatMessage fromJson(String message) {
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(message);
if (obj.has("header") && obj.has("payload")) {
JsonObject header = (JsonObject) obj.get("header");
JsonObject payload = (JsonObject) obj.get("payload");
if (header.has("name")) {
String messageName = header.get("name").getAsString();
if (SEND_PUBLIC_CHAT_MESSAGE.equals(messageName)) {
if (payload.has(Constants.MEETING_ID)
&& payload.has(Constants.MESSAGE)) {
String meetingId = payload.get(Constants.MEETING_ID).getAsString();
JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject();
Map<String, String> messageInfo = new HashMap<String, String>();
if (msgObj.has(ChatKeyUtil.CHAT_TYPE)
&& msgObj.has(ChatKeyUtil.MESSAGE)
&& msgObj.has(ChatKeyUtil.TO_USERNAME)
&& msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET)
&& msgObj.has(ChatKeyUtil.FROM_COLOR)
&& msgObj.has(ChatKeyUtil.TO_USERID)
&& msgObj.has(ChatKeyUtil.FROM_USERID)
&& msgObj.has(ChatKeyUtil.FROM_TIME)
&& msgObj.has(ChatKeyUtil.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
return new SendPublicChatMessage(meetingId, requesterId, messageInfo);
} else if (msgObj.has(Constants.CHAT_TYPE)
&& msgObj.has(Constants.MESSAGE)
&& msgObj.has(Constants.TO_USERNAME)
&& msgObj.has(Constants.FROM_TZ_OFFSET)
&& msgObj.has(Constants.FROM_COLOR)
&& msgObj.has(Constants.TO_USERID)
&& msgObj.has(Constants.FROM_USERID)
&& msgObj.has(Constants.FROM_TIME)
&& msgObj.has(Constants.FROM_USERNAME)){
messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString());
messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString());
messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString());
messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString());
messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString());
messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString());
String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID);
return new SendPublicChatMessage(meetingId, requesterId, messageInfo);
}
}
}
}
}
return null;
}
}

View File

@ -170,48 +170,6 @@ public class Util {
return null;
}
public ArrayList<Map<String, Object>> extractChatHistory(JsonArray history) {
ArrayList<Map<String, Object>> collection = new ArrayList<Map<String, Object>>();
Iterator<JsonElement> historyIter = history.iterator();
while (historyIter.hasNext()){
JsonElement chat = historyIter.next();
Map<String, Object> chatMap = extractChat((JsonObject)chat);
if (chatMap != null) {
collection.add(chatMap);
}
}
return collection;
}
private Map<String, Object> extractChat(JsonObject chat) {
if (chat.has(Constants.FROM_COLOR)
&& chat.has(Constants.MESSAGE)
&& chat.has(Constants.TO_USERNAME)
&& chat.has(Constants.FROM_TZ_OFFSET)
&& chat.has(Constants.FROM_COLOR)
&& chat.has(Constants.TO_USERID)
&& chat.has(Constants.FROM_USERID)
&& chat.has(Constants.FROM_TIME)
&& chat.has(Constants.FROM_USERNAME)){
Map<String, Object> chatMap = new HashMap<String, Object>();
chatMap.put(ChatKeyUtil.CHAT_TYPE, chat.get(Constants.CHAT_TYPE).getAsString());
chatMap.put(ChatKeyUtil.MESSAGE, chat.get(Constants.MESSAGE).getAsString());
chatMap.put(ChatKeyUtil.TO_USERNAME, chat.get(Constants.TO_USERNAME).getAsString());
chatMap.put(ChatKeyUtil.FROM_TZ_OFFSET, chat.get(Constants.FROM_TZ_OFFSET).getAsString());
chatMap.put(ChatKeyUtil.FROM_COLOR, chat.get(Constants.FROM_COLOR).getAsString());
chatMap.put(ChatKeyUtil.TO_USERID, chat.get(Constants.TO_USERID).getAsString());
chatMap.put(ChatKeyUtil.FROM_USERID, chat.get(Constants.FROM_USERID).getAsString());
chatMap.put(ChatKeyUtil.FROM_TIME, chat.get(Constants.FROM_TIME).getAsString());
chatMap.put(ChatKeyUtil.FROM_USERNAME, chat.get(Constants.FROM_USERNAME).getAsString());
return chatMap;
}
return null;
}
public ArrayList<Map<String, Object>> extractUsers(JsonArray users) {
ArrayList<Map<String, Object>> collection = new ArrayList<Map<String, Object>>();

View File

@ -233,26 +233,6 @@ public class MessagePublisher {
sender.send(MessagingConstants.TO_USERS_CHANNEL, msg.toJson());
}
public void getChatHistory(String meetingID, String requesterID, String replyTo) {
GetChatHistoryRequestMessage msg = new GetChatHistoryRequestMessage(meetingID, requesterID, replyTo);
sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson());
}
public void clearPublicChatMessages(String meetingID, String requesterID) {
ClearPublicChatHistoryRequestMessage msg = new ClearPublicChatHistoryRequestMessage(meetingID, requesterID);
sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson());
}
public void sendPublicMessage(String meetingID, String requesterID, Map<String, String> message) {
SendPublicChatMessage msg = new SendPublicChatMessage(meetingID, requesterID, message);
sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson());
}
public void sendPrivateMessage(String meetingID, String requesterID, Map<String, String> message) {
SendPrivateChatMessage msg = new SendPrivateChatMessage(meetingID, requesterID, message);
sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson());
}
public void requestDeskShareInfo(String meetingID, String requesterID, String replyTo) {
DeskShareGetInfoRequestMessage msg = new DeskShareGetInfoRequestMessage(meetingID, requesterID, replyTo);
sender.send(MessagingConstants.FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson());

View File

@ -5,7 +5,6 @@ import org.bigbluebutton.red5.client.MeetingClientMessageSender;
import org.bigbluebutton.red5.client.PollingClientMessageSender;
import org.bigbluebutton.red5.client.PresentationClientMessageSender;
import org.bigbluebutton.red5.client.UserClientMessageSender;
import org.bigbluebutton.red5.client.ChatClientMessageSender;
import org.bigbluebutton.red5.client.WhiteboardClientMessageSender;
import org.bigbluebutton.red5.client.DeskShareMessageSender;
import org.bigbluebutton.red5.client.messaging.IConnectionInvokerService;
@ -17,7 +16,6 @@ public class RedisPubSubMessageHandler implements MessageHandler {
private IConnectionInvokerService service;
private UserClientMessageSender userMessageSender;
private MeetingClientMessageSender meetingMessageSender;
private ChatClientMessageSender chatMessageSender;
private PresentationClientMessageSender presentationMessageSender;
private WhiteboardClientMessageSender whiteboardMessageSender;
private DeskShareMessageSender deskShareMessageSender;
@ -28,7 +26,6 @@ public class RedisPubSubMessageHandler implements MessageHandler {
this.service = s;
userMessageSender = new UserClientMessageSender(service);
meetingMessageSender = new MeetingClientMessageSender(service);
chatMessageSender = new ChatClientMessageSender(service);
presentationMessageSender = new PresentationClientMessageSender(service);
whiteboardMessageSender = new WhiteboardClientMessageSender(service);
deskShareMessageSender = new DeskShareMessageSender(service);
@ -42,9 +39,7 @@ public class RedisPubSubMessageHandler implements MessageHandler {
@Override
public void handleMessage(String pattern, String channel, String message) {
// System.out.println("in red5 getting message: " + channel + " " + message);
if (channel.equalsIgnoreCase(MessagingConstants.FROM_CHAT_CHANNEL)) {
chatMessageSender.handleChatMessage(message);
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_PRESENTATION_CHANNEL)) {
if (channel.equalsIgnoreCase(MessagingConstants.FROM_PRESENTATION_CHANNEL)) {
presentationMessageSender.handlePresentationMessage(message);
} else if (channel.equalsIgnoreCase(MessagingConstants.FROM_MEETING_CHANNEL)) {
meetingMessageSender.handleMeetingMessage(message);

View File

@ -1,13 +0,0 @@
package org.bigbluebutton.red5.service;
public class ChatKeyUtil {
public static final String CHAT_TYPE = "chatType";
public static final String FROM_USERID = "fromUserID";
public static final String FROM_USERNAME = "fromUsername";
public static final String FROM_COLOR = "fromColor";
public static final String FROM_TIME = "fromTime";
public static final String FROM_TZ_OFFSET = "fromTimezoneOffset";
public static final String TO_USERID = "toUserID";
public static final String TO_USERNAME = "toUsername";
public static final String MESSAGE = "message";
}

View File

@ -1,132 +0,0 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.red5.service;
import java.util.HashMap;
import java.util.Map;
import java.util.Date;
import org.bigbluebutton.red5.BigBlueButtonSession;
import org.bigbluebutton.red5.Constants;
import org.bigbluebutton.red5.pubsub.MessagePublisher;
import org.red5.server.api.Red5;
public class ChatService {
private MessagePublisher red5BBBInGw;
private int maxMessageLength;
public void sendPublicChatHistory() {
String meetingID = Red5.getConnectionLocal().getScope().getName();
String requesterID = getBbbSession().getInternalUserID();
// Just hardcode as we don't really need it for flash client. (ralam may 7, 2014)
String replyTo = meetingID + "/" + requesterID;
red5BBBInGw.getChatHistory(meetingID, requesterID, replyTo);
}
public void clearPublicChatMessages() {
String meetingID = Red5.getConnectionLocal().getScope().getName();
String requesterID = getBbbSession().getInternalUserID();
red5BBBInGw.clearPublicChatMessages(meetingID, requesterID);
}
private BigBlueButtonSession getBbbSession() {
return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION);
}
public void sendPublicMessage(Map<String, Object> msg) {
String chatType = msg.get(ChatKeyUtil.CHAT_TYPE).toString();
String fromUserID = msg.get(ChatKeyUtil.FROM_USERID).toString();
String fromUsername = msg.get(ChatKeyUtil.FROM_USERNAME ).toString();
String fromColor = msg.get(ChatKeyUtil.FROM_COLOR).toString();
String fromTime = Long.toString(new Date().getTime());
String fromTimezoneOffset = msg.get(ChatKeyUtil.FROM_TZ_OFFSET).toString();
String toUserID = msg.get(ChatKeyUtil.TO_USERID).toString();
String toUsername = msg.get(ChatKeyUtil.TO_USERNAME).toString();
String chatText = msg.get(ChatKeyUtil.MESSAGE).toString();
Map<String, String> message = new HashMap<String, String>();
message.put(ChatKeyUtil.CHAT_TYPE, chatType);
message.put(ChatKeyUtil.FROM_USERID, fromUserID);
message.put(ChatKeyUtil.FROM_USERNAME, fromUsername);
message.put(ChatKeyUtil.FROM_COLOR, fromColor);
message.put(ChatKeyUtil.FROM_TIME, fromTime);
message.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset);
message.put(ChatKeyUtil.TO_USERID, toUserID);
message.put(ChatKeyUtil.TO_USERNAME, toUsername);
message.put(ChatKeyUtil.MESSAGE, chatText);
String meetingID = Red5.getConnectionLocal().getScope().getName();
String requesterID = getBbbSession().getInternalUserID();
// The message is being ignored in the red5 application to avoid copying it to any another application which that may cause a memory issue
if (chatText.length() <= maxMessageLength) {
red5BBBInGw.sendPublicMessage(meetingID, requesterID, message);
}
else {
// log.warn("sendPublicMessage maximum allowed message length exceeded (length: [" + chatText.length() + "], message: [" + chatText + "])");
}
}
public void setRed5Publisher(MessagePublisher inGW) {
red5BBBInGw = inGW;
}
public void setMaxMessageLength(int maxLength) {
maxMessageLength = maxLength;
}
public void sendPrivateMessage(Map<String, Object> msg){
String chatType = msg.get(ChatKeyUtil.CHAT_TYPE).toString();
String fromUserID = msg.get(ChatKeyUtil.FROM_USERID).toString();
String fromUsername = msg.get(ChatKeyUtil.FROM_USERNAME ).toString();
String fromColor = msg.get(ChatKeyUtil.FROM_COLOR).toString();
String fromTime = Long.toString(new Date().getTime());
String fromTimezoneOffset = msg.get(ChatKeyUtil.FROM_TZ_OFFSET).toString();
String toUserID = msg.get(ChatKeyUtil.TO_USERID).toString();
String toUsername = msg.get(ChatKeyUtil.TO_USERNAME).toString();
String chatText = msg.get(ChatKeyUtil.MESSAGE).toString();
Map<String, String> message = new HashMap<String, String>();
message.put(ChatKeyUtil.CHAT_TYPE, chatType);
message.put(ChatKeyUtil.FROM_USERID, fromUserID);
message.put(ChatKeyUtil.FROM_USERNAME, fromUsername);
message.put(ChatKeyUtil.FROM_COLOR, fromColor);
message.put(ChatKeyUtil.FROM_TIME, fromTime);
message.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset);
message.put(ChatKeyUtil.TO_USERID, toUserID);
message.put(ChatKeyUtil.TO_USERNAME, toUsername);
message.put(ChatKeyUtil.MESSAGE, chatText);
String meetingID = Red5.getConnectionLocal().getScope().getName();
String requesterID = getBbbSession().getInternalUserID();
// The message is being ignored in the red5 application to avoid copying it to any another application which that may cause a memory issue
if (chatText.length() <= maxMessageLength) {
red5BBBInGw.sendPrivateMessage(meetingID, requesterID, message);
}
else {
// log.warn("sendPrivateMessage maximum allowed message length exceeded (length: [" + chatText.length() + "], message: [" + chatText + "])");
}
}
}

View File

@ -86,11 +86,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="red5Publisher"><ref bean="red5Publisher"/></property>
</bean>
<bean id="chat.service" class="org.bigbluebutton.red5.service.ChatService">
<property name="red5Publisher"> <ref bean="red5Publisher"/></property>
<property name="maxMessageLength" value="1024"/>
</bean>
<bean id="participants.service" class="org.bigbluebutton.red5.service.ParticipantsService">
<property name="red5Publisher"> <ref bean="red5Publisher"/> </property>
</bean>