diff --git a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java index 7408b885e7..a6544cdf5b 100755 --- a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java +++ b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -106,6 +106,7 @@ public interface IBigBlueButtonInGW { void getChatHistory(String meetingID, String requesterID, String replyTo); void sendPublicMessage(String meetingID, String requesterID, Map message); void sendPrivateMessage(String meetingID, String requesterID, Map message); + void clearChatHistory(String meetingID, String requesterID, String replyTo); // Whiteboard void sendWhiteboardAnnotation(String meetingID, String requesterID, java.util.Map annotation); diff --git a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java index 8a2d83e450..7b68c20259 100755 --- a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java +++ b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java @@ -4,6 +4,7 @@ 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.ClearChatHistoryRequestMessage; import com.google.gson.JsonParser; import com.google.gson.JsonObject; @@ -36,6 +37,9 @@ public class ChatMessageReceiver implements MessageHandler{ } else if (SendPrivateChatMessage.SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)){ SendPrivateChatMessage msg = SendPrivateChatMessage.fromJson(message); bbbGW.sendPrivateMessage(msg.meetingId, msg.requesterId, msg.messageInfo); + } else if (ClearChatHistoryRequestMessage.CLEAR_CHAT_HISTORY_REQUEST.equals(messageName)){ + ClearChatHistoryRequestMessage msg = ClearChatHistoryRequestMessage.fromJson(message); + bbbGW.clearChatHistory(msg.meetingId, msg.requesterId, msg.replyTo); } } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala index 335949782e..c42a6f8ab2 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -363,6 +363,10 @@ class BigBlueButtonInGW(val system: ActorSystem, recorderApp: RecorderApplicatio bbbActor ! new SendPrivateMessageRequest(meetingID, requesterID, mapAsScalaMap(message).toMap) } + def clearChatHistory(meetingID: String, requesterID: String, replyTo: String) { + bbbActor ! new ClearChatHistoryRequest(meetingID, requesterID, replyTo) + } + /** * ******************************************************************* * Message Interface for Whiteboard diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala index 62e06a2b16..46e6eb2e09 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala @@ -103,6 +103,8 @@ class MeetingActor(val mProps: MeetingProperties, val outGW: OutMessageGateway) handleSendPublicMessageRequest(msg) case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) + case msg: ClearChatHistoryRequest => + handleClearChatHistoryRequest(msg) case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) case msg: UserDisconnectedFromGlobalAudio => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala index d4ea137b35..492891a09a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala @@ -45,6 +45,7 @@ class MessageSenderActor(val meetingId: String, val service: MessageSender) case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) + case msg: ClearChatHistoryReply => handleClearChatHistoryReply(msg) case msg: MeetingCreated => handleMeetingCreated(msg) case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) @@ -146,6 +147,11 @@ class MessageSenderActor(val meetingId: String, val service: MessageSender) service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) } + private def handleClearChatHistoryReply(msg: ClearChatHistoryReply) { + val json = ChatMessageToJsonConverter.clearChatHistoryReplyToJson(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()) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala index 526031f784..9746edf2ef 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala @@ -47,6 +47,7 @@ case class GetRecordingStatus(meetingID: String, userId: String) extends InMessa case class GetChatHistoryRequest(meetingID: String, requesterID: String, replyTo: 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 ClearChatHistoryRequest(meetingID: String, requesterID: String, replyTo: 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, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala index be9df49963..7c918d5b81 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/MessageNames.scala @@ -30,6 +30,7 @@ object MessageNames { val GET_CHAT_HISTORY = "get_chat_history_request" val SEND_PUBLIC_MESSAGE = "send_public_chat_message_request" val SEND_PRIVATE_MESSAGE = "send_private_chat_message_request" + val CLEAR_CHAT_HISTORY = "clear_chat_history_request" val GET_CURRENT_LAYOUT = "get_current_layout_request" val SET_LAYOUT = "set_layout_request" val BROADCAST_LAYOUT = "broadcast_layout_request" @@ -128,6 +129,7 @@ object MessageNames { val GET_CHAT_HISTORY_REPLY = "get_chat_history_reply" val SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message" val SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message" + val CLEAR_CHAT_HISTORY_REPLY = "clear_chat_history_reply" val GET_CURRENT_LAYOUT_REPLY = "get_current_layout_reply" val SET_LAYOUT_REPLY = "set_layout_reply" val BROADCAST_LAYOUT_REPLY = "broadcast_layout_reply" diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala index 65dfeb223e..71ba1ab7df 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala @@ -74,6 +74,8 @@ case class SendPublicMessageEvent(meetingID: String, recorded: Boolean, requeste message: Map[String, String]) extends IOutMessage case class SendPrivateMessageEvent(meetingID: String, recorded: Boolean, requesterID: String, message: Map[String, String]) extends IOutMessage +case class ClearChatHistoryReply(meetingID: String, recorded: Boolean, requesterID: String, + replyTo: String) extends IOutMessage // Layout case class GetCurrentLayoutReply(meetingID: String, recorded: Boolean, requesterID: String, layoutID: String, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala index 235376109f..3eec6f62b2 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala @@ -26,4 +26,10 @@ trait ChatApp { val privMsg = msg.message.toMap outGW.send(new SendPrivateMessageEvent(mProps.meetingID, mProps.recorded, msg.requesterID, privMsg)) } + + def handleClearChatHistoryRequest(msg: ClearChatHistoryRequest) { + chatModel.clearChatHistory() + outGW.send(new ClearChatHistoryReply(mProps.meetingID, mProps.recorded, msg.requesterID, msg.replyTo)) + } + } \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala index b6dd6b49e9..db66ea1450 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala @@ -16,4 +16,8 @@ class ChatModel { def addNewChatMessage(msg: Map[String, String]) { messages append msg } + + def clearChatHistory() { + messages.clear(); + } } \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala index 83d7bedafe..3434709009 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala @@ -64,4 +64,13 @@ object ChatMessageToJsonConverter { val header = Util.buildHeader(MessageNames.SEND_PRIVATE_CHAT_MESSAGE, None) Util.buildJson(header, payload) } + + def clearChatHistoryReplyToJson(msg: ClearChatHistoryReply): 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_CHAT_HISTORY_REPLY, None) + Util.buildJson(header, payload) + } } \ No newline at end of file diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearChatHistoryReplyMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearChatHistoryReplyMessage.java new file mode 100644 index 0000000000..fda8ab67a8 --- /dev/null +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearChatHistoryReplyMessage.java @@ -0,0 +1,55 @@ +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 ClearChatHistoryReplyMessage implements ISubscribedMessage { + public static final String CLEAR_CHAT_HISTORY_REPLY = "clear_chat_history_reply"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String requesterId; + + + public ClearChatHistoryReplyMessage(String meetingId, String requesterId) { + this.meetingId = meetingId; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REQUESTER_ID, requesterId); + + java.util.HashMap header = MessageBuilder.buildHeader(CLEAR_CHAT_HISTORY_REPLY, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static ClearChatHistoryReplyMessage 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_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 ClearChatHistoryReplyMessage(meetingId, requesterId); + } + } + } + } + return null; + } +} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearChatHistoryRequestMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearChatHistoryRequestMessage.java new file mode 100644 index 0000000000..861f8a9fb7 --- /dev/null +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearChatHistoryRequestMessage.java @@ -0,0 +1,56 @@ +package org.bigbluebutton.common.messages; + +import java.util.HashMap; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +public class ClearChatHistoryRequestMessage implements IBigBlueButtonMessage { + public static final String CLEAR_CHAT_HISTORY_REQUEST = "clear_chat_history_request"; + public static final String VERSION = "0.0.1"; + + public final String meetingId; + public final String replyTo; + public final String requesterId; + + + public ClearChatHistoryRequestMessage(String meetingId, String requesterId, String replyTo) { + this.meetingId = meetingId; + this.replyTo = replyTo; + this.requesterId = requesterId; + } + + public String toJson() { + HashMap payload = new HashMap(); + payload.put(Constants.MEETING_ID, meetingId); + payload.put(Constants.REPLY_TO, replyTo); + payload.put(Constants.REQUESTER_ID, requesterId); + + java.util.HashMap header = MessageBuilder.buildHeader(CLEAR_CHAT_HISTORY_REQUEST, VERSION, null); + return MessageBuilder.buildJson(header, payload); + } + + public static ClearChatHistoryRequestMessage 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_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 ClearChatHistoryRequestMessage(meetingId, requesterId, replyTo); + } + } + } + } + return null; + } +} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java index db2487eca5..9769a0e539 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java @@ -6,6 +6,7 @@ import java.util.Map; import org.bigbluebutton.common.messages.GetChatHistoryReplyMessage; import org.bigbluebutton.common.messages.SendPrivateChatMessage; import org.bigbluebutton.common.messages.SendPublicChatMessage; +import org.bigbluebutton.common.messages.ClearChatHistoryReplyMessage; import org.bigbluebutton.red5.client.messaging.BroadcastClientMessage; import org.bigbluebutton.red5.client.messaging.ConnectionInvokerService; import org.bigbluebutton.red5.client.messaging.DirectClientMessage; @@ -54,6 +55,13 @@ public class ChatClientMessageSender { processGetChatHistoryReply(gch); } break; + case ClearChatHistoryReplyMessage.CLEAR_CHAT_HISTORY_REPLY: + ClearChatHistoryReplyMessage gcl = ClearChatHistoryReplyMessage.fromJson(message); + + if (gcl != null) { + processClearChatHistoryReply(gcl); + } + break; } } } @@ -111,4 +119,19 @@ public class ChatClientMessageSender { service.sendMessage(m); } + private void processClearChatHistoryReply(ClearChatHistoryReplyMessage gcl) { + + Map args = new HashMap(); + args.put("meetingId", gcl.meetingId); + args.put("requester_id", gcl.requesterId); + args.put("message", "ClearChat"); + + Map message = new HashMap(); + Gson gson = new Gson(); + message.put("msg", gson.toJson(args.get("message"))); + + BroadcastClientMessage m = new BroadcastClientMessage(gcl.meetingId, "ChatClearPublicMessageCommand", message); + service.sendMessage(m); + } + } diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java index 67cc8ab511..0e07db7f82 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java @@ -243,6 +243,10 @@ public class MessagePublisher { sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson()); } + public void clearPublicChatMessages(String meetingID, String requesterID, String replyTo) { + ClearChatHistoryRequestMessage msg = new ClearChatHistoryRequestMessage(meetingID, requesterID, replyTo); + sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson()); + } public void sendPublicMessage(String meetingID, String requesterID, Map message) { SendPublicChatMessage msg = new SendPublicChatMessage(meetingID, requesterID, message); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java index 51e0905491..8b0031385b 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java @@ -27,7 +27,7 @@ import org.bigbluebutton.red5.pubsub.MessagePublisher; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; - + public class ChatService { private static Logger log = Red5LoggerFactory.getLogger( ChatService.class, "bigbluebutton" ); @@ -43,6 +43,15 @@ public class ChatService { red5BBBInGw.getChatHistory(meetingID, requesterID, replyTo); } + public void clearPublicChatMessages() { + 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.clearPublicChatMessages(meetingID, requesterID, replyTo); + } + private BigBlueButtonSession getBbbSession() { return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION); } diff --git a/bigbluebutton-client/branding/default/style/css/BBBBlack.css b/bigbluebutton-client/branding/default/style/css/BBBBlack.css index af1050468f..23dc231222 100755 --- a/bigbluebutton-client/branding/default/style/css/BBBBlack.css +++ b/bigbluebutton-client/branding/default/style/css/BBBBlack.css @@ -93,7 +93,7 @@ DataGrid { } -.whiteboardUndoButtonStyle, .whiteboardCircleButtonStyle, .whiteboardClearButtonStyle, +.whiteboardUndoButtonStyle, .whiteboardCircleButtonStyle, .dlearButtonStyle, .whiteboardTriangleButtonStyle, .whiteboardTextButtonStyle, .whiteboardRectangleButtonStyle, .whiteboardPanZoomButtonStyle, .whiteboardLineButtonStyle, .whiteboardScribbleButtonStyle { @@ -123,7 +123,7 @@ DataGrid { icon: Embed('assets/images/ellipse.png'); } -.whiteboardClearButtonStyle { +.dlearButtonStyle { icon: Embed('assets/images/delete.png'); } diff --git a/bigbluebutton-client/branding/default/style/css/BBBDefault.css b/bigbluebutton-client/branding/default/style/css/BBBDefault.css index 2839211758..dd686f810b 100755 --- a/bigbluebutton-client/branding/default/style/css/BBBDefault.css +++ b/bigbluebutton-client/branding/default/style/css/BBBDefault.css @@ -209,7 +209,7 @@ DataGrid { } -.whiteboardUndoButtonStyle, .whiteboardCircleButtonStyle, .whiteboardClearButtonStyle, +.whiteboardUndoButtonStyle, .whiteboardCircleButtonStyle, .clearButtonStyle, .whiteboardTriangleButtonStyle, .whiteboardTextButtonStyle, .whiteboardRectangleButtonStyle, .whiteboardPanZoomButtonStyle, .whiteboardLineButtonStyle, .whiteboardScribbleButtonStyle { @@ -239,7 +239,7 @@ DataGrid { icon: Embed('assets/images/ellipse.png'); } -.whiteboardClearButtonStyle { +.clearButtonStyle { icon: Embed('assets/images/delete.png'); } diff --git a/bigbluebutton-client/locale/en_US/bbbResources.properties b/bigbluebutton-client/locale/en_US/bbbResources.properties index 89ccfccdb8..a744853c90 100755 --- a/bigbluebutton-client/locale/en_US/bbbResources.properties +++ b/bigbluebutton-client/locale/en_US/bbbResources.properties @@ -280,6 +280,8 @@ bbb.chat.copyBtn.toolTip = Copy chat bbb.chat.copyBtn.accessibilityName = Copy chat to clipboard bbb.chat.copyBtn.label = Copy bbb.chat.copy.complete = Chat copied to clipboard +bbb.chat.clearBtn.toolTip = Clear chat +bbb.chat.clearBtn.accessibilityName = Clear the chat history bbb.chat.contextmenu.copyalltext = Copy All Text bbb.chat.publicChatUsername = Public bbb.chat.optionsTabName = Options diff --git a/bigbluebutton-client/locale/pt_BR/bbbResources.properties b/bigbluebutton-client/locale/pt_BR/bbbResources.properties index c557aee93c..1d1a628efc 100644 --- a/bigbluebutton-client/locale/pt_BR/bbbResources.properties +++ b/bigbluebutton-client/locale/pt_BR/bbbResources.properties @@ -281,6 +281,8 @@ bbb.chat.copyBtn.toolTip = Copiar bate-papo bbb.chat.copyBtn.accessibilityName = Copiar bate-papo para a área de transferência bbb.chat.copyBtn.label = Copiar bbb.chat.copy.complete = Bate-papo copiado para a área de transferência +bbb.chat.clearBtn.toolTip = Limpar bate-papo +bbb.chat.clearBtn.accessibilityName = Limpar conteúdo do histórico do Bate-papo bbb.chat.publicChatUsername = Público bbb.chat.optionsTabName = Opções bbb.chat.privateChatSelect = Selecione uma pessoa para um bate-papo privado diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatToolbarButtonEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatToolbarButtonEvent.as index 928085d4cc..2df1b48d39 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatToolbarButtonEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatToolbarButtonEvent.as @@ -6,6 +6,7 @@ package org.bigbluebutton.modules.chat.events { public static const SAVE_CHAT_TOOLBAR_EVENT:String = "SAVE_CHAT_TOOLBAR_EVENT"; public static const COPY_CHAT_TOOLBAR_EVENT:String = "COPY_CHAT_TOOLBAR_EVENT"; + public static const CLEAR_CHAT_TOOLBAR_EVENT:String = "CLEAR_CHAT_TOOLBAR_EVENT"; public function ChatToolbarButtonEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ClearPublicChatEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ClearPublicChatEvent.as new file mode 100644 index 0000000000..47c7fcbf10 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ClearPublicChatEvent.as @@ -0,0 +1,36 @@ +/** +* 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 . +* +*/ +package org.bigbluebutton.modules.chat.events +{ + import flash.events.Event; + + import org.bigbluebutton.modules.chat.vo.ChatMessageVO; + + public class ClearPublicChatEvent extends Event + { + public static const CLEAR_PUBLIC_CHAT_EVENT:String = 'CLEAR_PUBLIC_CHAT_EVENT'; + + + public function ClearPublicChatEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + } +} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml index 237314cff6..b1eae45bfb 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml @@ -33,6 +33,7 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.chat.events.ChatCopyEvent; import org.bigbluebutton.modules.chat.events.ChatEvent; import org.bigbluebutton.modules.chat.events.ChatSaveEvent; + import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent; import org.bigbluebutton.modules.chat.events.SendPrivateChatMessageEvent; import org.bigbluebutton.modules.chat.events.SendPublicChatMessageEvent; import org.bigbluebutton.modules.chat.events.StartChatModuleEvent; @@ -97,6 +98,10 @@ with BigBlueButton; if not, see . + + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as index 25280671e7..dee55ac23e 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as @@ -86,6 +86,17 @@ package org.bigbluebutton.modules.chat.model var msg:ChatMessage = messages.getItemAt(messages.length - 1) as ChatMessage; return msg.time; } + + public function clearChat():void{ + var cm:ChatMessage = new ChatMessage(); + cm.time = getLastTime(); + cm.text = "The chat was cleared by a moderator"; + cm.name = ""; + cm.senderColor = uint(0x086187); + + messages.removeAll(); + messages.addItem(cm); + } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as index 6dc2108168..14053ad8ff 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as @@ -75,6 +75,10 @@ package org.bigbluebutton.modules.chat.services } + public function clearPublicChatMessages():void { + sender.clearPublicChatMessages(); + } + public function sendPublicMessage(message:ChatMessageVO):void { sender.sendPublicMessage(message); } @@ -103,14 +107,14 @@ package org.bigbluebutton.modules.chat.services 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 - ExternalInterface.call("clientReady", ResourceUtil.getInstance().getString('bbb.accessibility.clientReady')); + ExternalInterface.call("clientReady", ResourceUtil.getInstance().getString('bbb.accessibility.clientReady')); } if (UsersUtil.amIModerator()) { @@ -125,11 +129,11 @@ package org.bigbluebutton.modules.chat.services moderatorOnlyMsg.toUserID = SPACE; moderatorOnlyMsg.toUsername = SPACE; moderatorOnlyMsg.message = MeetingModel.getInstance().modOnlyMessage; - + var moderatorOnlyMsgEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT); moderatorOnlyMsgEvent.message = moderatorOnlyMsg; moderatorOnlyMsgEvent.history = false; - dispatcher.dispatchEvent(moderatorOnlyMsgEvent); + dispatcher.dispatchEvent(moderatorOnlyMsgEvent); } } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as index efb0c79f33..caaddeb5b4 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as @@ -29,6 +29,7 @@ package org.bigbluebutton.modules.chat.services 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.vo.ChatMessageVO; public class MessageReceiver implements IMessageListener @@ -57,6 +58,9 @@ package org.bigbluebutton.modules.chat.services case "ChatRequestMessageHistoryReply": handleChatRequestMessageHistoryReply(message); break; + case "ChatClearPublicMessageCommand": + handleChatClearPublicMessageCommand(message); + break; default: // LogUtil.warn("Cannot handle message [" + messageName + "]"); } @@ -79,7 +83,7 @@ package org.bigbluebutton.modules.chat.services private function handleChatReceivePublicMessageCommand(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; @@ -123,5 +127,12 @@ package org.bigbluebutton.modules.chat.services pcCoreEvent.message = message; dispatcher.dispatchEvent(pcCoreEvent); } + + private function handleChatClearPublicMessageCommand(message:Object):void { + LOGGER.debug("Handling CLEAR chat history message [{0}]", [message.msg]); + + var clearChatEvent:ClearPublicChatEvent = new ClearPublicChatEvent(ClearPublicChatEvent.CLEAR_PUBLIC_CHAT_EVENT); + dispatcher.dispatchEvent(clearChatEvent); + } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as index 6ad463e8e9..6dcfcfdd9a 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as @@ -60,7 +60,7 @@ package org.bigbluebutton.modules.chat.services message.toObj() ); } - + public function sendPrivateMessage(message:ChatMessageVO):void { LOGGER.debug("Sending [chat.sendPrivateMessage] to server."); @@ -76,5 +76,19 @@ package org.bigbluebutton.modules.chat.services 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); + } + ); + } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml index 384a8077fc..203bbe5feb 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml @@ -56,6 +56,7 @@ with BigBlueButton; if not, see . + @@ -99,6 +100,7 @@ with BigBlueButton; if not, see . 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.events.ClearPublicChatEvent; import org.bigbluebutton.modules.chat.model.ChatConversation; import org.bigbluebutton.modules.chat.model.ChatOptions; import org.bigbluebutton.modules.chat.vo.ChatMessageVO; @@ -764,6 +766,12 @@ with BigBlueButton; if not, see . } } + private function handleClearChatBoxMessages(event:ClearPublicChatEvent):void{ + chatMessages.clearChat(); + invalidateDisplayList(); + validateNow(); + } + override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); @@ -775,7 +783,7 @@ with BigBlueButton; if not, see . chatToolbar.width = 45; chatToolbar.x = (chatMessagesCanvas.width - chatToolbar.width) - 10; - chatToolbar.y = 10; + chatToolbar.y = 20; if(chatMessagesList.mx_internal::scroll_verticalScrollBar != null && chatMessagesList.mx_internal::scroll_verticalScrollBar.visible){ chatToolbar.width -= chatMessagesList.mx_internal::scroll_verticalScrollBar.width; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml index a5ec7f4bf9..6b355a21bf 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml @@ -3,7 +3,8 @@ + + + + @@ -96,8 +114,7 @@ height="22" toolTip="{ResourceUtil.getInstance().getString('bbb.chat.saveBtn.toolTip')}" click="sendSaveEvent()" - tabIndex="{baseIndex+1}" - accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.copyBtn.accessibilityName')}"/> + accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.saveBtn.accessibilityName')}"/> + accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.copyBtn.accessibilityName')}"/> + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/buttons/ClearButton.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/buttons/ClearButton.mxml index e3a44a2902..72ed116422 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/buttons/ClearButton.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/buttons/ClearButton.mxml @@ -20,9 +20,9 @@ with BigBlueButton; if not, see . --> + accessibilityName="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.clear.accessibilityName')}">