Merge remote-tracking branch 'upstream/master' into implement-rights-management

This commit is contained in:
Chad Pilkey 2017-11-09 14:36:25 -05:00
commit 46e0253f17
21 changed files with 337 additions and 168 deletions

View File

@ -14,7 +14,10 @@ trait CreateNewPresentationPodPubMsgHdlr extends SystemConfiguration {
def handle(msg: CreateNewPresentationPodPubMsg, state: MeetingState2x,
liveMeeting: LiveMeeting, bus: MessageBus): MeetingState2x = {
if (applyPermissionCheck && !PermissionCheck.isAllowed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
if (applyPermissionCheck && !PermissionCheck.isAllowed(
PermissionCheck.MOD_LEVEL,
PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId
)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to create new presentation pod."
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW)

View File

@ -144,11 +144,11 @@ class MeetingActor(
// Create a default publish group chat
state = GroupChatApp.createDefaultPublicGroupChat(GroupChatApp.MAIN_PUBLIC_CHAT, state)
state = GroupChatApp.genTestChatMsgHistory(GroupChatApp.MAIN_PUBLIC_CHAT, state, BbbSystemConst.SYSTEM_USER, liveMeeting)
//state = GroupChatApp.genTestChatMsgHistory(GroupChatApp.MAIN_PUBLIC_CHAT, state, BbbSystemConst.SYSTEM_USER, liveMeeting)
// Create a default publish group chat
state = GroupChatApp.createDefaultPublicGroupChat("TEST_GROUP_CHAT", state)
state = GroupChatApp.genTestChatMsgHistory("TEST_GROUP_CHAT", state, BbbSystemConst.SYSTEM_USER, liveMeeting)
//state = GroupChatApp.createDefaultPublicGroupChat("TEST_GROUP_CHAT", state)
//state = GroupChatApp.genTestChatMsgHistory("TEST_GROUP_CHAT", state, BbbSystemConst.SYSTEM_USER, liveMeeting)
log.debug("NUM GROUP CHATS = " + state.groupChats.findAllPublicChats().length)

View File

@ -55,7 +55,7 @@ class ReceivedJsonMsgHdlrActor(val msgFromAkkaAppsEventBus: MsgFromAkkaAppsEvent
}
def handle(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = {
log.debug("*************** Route envelope name " + envelope.name)
//log.debug("*************** Route envelope name " + envelope.name)
envelope.name match {
case MeetingCreatedEvtMsg.NAME =>
route[MeetingCreatedEvtMsg](envelope, jsonNode)

View File

@ -0,0 +1,14 @@
package org.bigbluebutton.core.events
{
import flash.events.Event;
public class ClosePendingGuestWindow extends Event
{
public static const CLOSE_PENDING_GUEST_WINDOW: String = "CLOSE_PENDING_GUEST_WINDOW";
public function ClosePendingGuestWindow()
{
super(CLOSE_PENDING_GUEST_WINDOW, false, false);
}
}
}

View File

@ -73,6 +73,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{BBBEvent.WAITING_FOR_MODERATOR_ACCEPTANCE}" method="openWaitWindow" />
<mate:Listener type="{BBBEvent.RECONNECT_DISCONNECTED_EVENT}" method="closeWaitWindow"/>
<mate:Listener type="{RoundTripLatencyReceivedEvent.ROUND_TRIP_LATENCY_RECEIVED}" method="handleRoundTripLatencyReceivedEvent"/>
<mate:Listener type="{ClosePendingGuestWindow.CLOSE_PENDING_GUEST_WINDOW}" method="handleClosePendingGuestWindow" />
</fx:Declarations>
<fx:Script>
<![CDATA[
@ -110,6 +111,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.core.events.NewGuestWaitingEvent;
import org.bigbluebutton.core.events.RoundTripLatencyReceivedEvent;
import org.bigbluebutton.core.events.SwitchedLayoutEvent;
import org.bigbluebutton.core.events.ClosePendingGuestWindow;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.core.vo.LockSettingsVO;
import org.bigbluebutton.main.events.AppVersionEvent;
import org.bigbluebutton.main.events.BBBEvent;
@ -183,6 +186,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var resizeExecuting:Boolean = false;
private var _respTimer:ResponsivenessTimer;
private var guestWindow:PendingGuestsWindow;
public function getLogWindow() : LogWindow
{
@ -332,19 +337,30 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function refreshGuestView(evt:NewGuestWaitingEvent):void {
LOGGER.debug("NewGuestWaitingEvent");
LOGGER.debug("NewGuestWaitingEvent");
// do not show the guest window if the user isn't moderator or if he's waiting for acceptance
if (!UsersUtil.amIModerator() || UsersUtil.amIWaitingForAcceptance() && usersOptions.enableGuestUI) {
return;
}
LOGGER.debug("OPENING GUEST WINDOW");
var guestWindow:PendingGuestsWindow = PopUpUtil.createModalPopUp( mdiCanvas, PendingGuestsWindow, false) as PendingGuestsWindow;
var guestUsers:ArrayCollection = new ArrayCollection(LiveMeeting.inst().guestsWaiting.getGuests());
LOGGER.debug("OPENING GUEST WINDOW");
if (guestWindow == null) {
guestWindow = PopUpUtil.createModalPopUp( mdiCanvas, PendingGuestsWindow, false) as PendingGuestsWindow;
guestWindow.x = systemManager.screen.width - guestWindow.width - 20;
guestWindow.y = 20;
}
guestWindow.refreshGuestView();
}
private function handleClosePendingGuestWindow(event: ClosePendingGuestWindow): void {
if (guestWindow != null) {
PopUpUtil.removePopUp(guestWindow);
guestWindow = null;
}
}
public function removeGuestWindow(evt:BBBEvent):void {
LOGGER.debug("REMOVE GUEST WINDOW");
//if (guestWindow != null) {

View File

@ -32,6 +32,7 @@ $Id: $
<fx:Declarations>
<mate:Listener type="{BBBEvent.ACCEPT_ALL_WAITING_GUESTS}" method="acceptAllWaitingGuests" />
<mate:Listener type="{BBBEvent.DENY_ALL_WAITING_GUESTS}" method="denyAllWaitingGuests" />
<mate:Listener type="{GuestWaitingApprovedEvent.GUEST_WAITING_APPROVED}" method="handleGuestWaitingApprovedEvent" />
<mate:Listener type="{RemoveGuestFromViewEvent.REMOVE_GUEST}" receive="{remove(event.userid)}" />
</fx:Declarations>
@ -45,6 +46,8 @@ $Id: $
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.core.model.users.GuestWaiting;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.core.events.GuestWaitingApprovedEvent;
import org.bigbluebutton.core.events.ClosePendingGuestWindow;
import org.bigbluebutton.main.events.RemoveGuestEvent;
import org.bigbluebutton.main.events.RemoveGuestFromViewEvent;
import org.bigbluebutton.main.events.ResponseModeratorEvent;
@ -90,6 +93,13 @@ $Id: $
public function denyAllWaitingGuests(event:BBBEvent):void {
sendResponseToAllGuests(false);
}
private function handleGuestWaitingApprovedEvent(event: GuestWaitingApprovedEvent): void {
refreshGuestView();
if (guestUsers.length == 0) {
closeWindow();
}
}
public function removeAllGuests():void {
closeWindow();
@ -108,7 +118,8 @@ $Id: $
}
public function closeWindow():void {
PopUpUtil.removePopUp(this);
var event:ClosePendingGuestWindow = new ClosePendingGuestWindow();
dispatcher.dispatchEvent(event);
}
]]>

View File

@ -0,0 +1,17 @@
package org.bigbluebutton.modules.chat.events
{
import flash.events.Event;
public class FocusOnChatBoxEvent extends Event
{
public static const FOCUS_ON_CHATBOX_EVENT:String = 'focus on chat box event';
public var chatId: String;
public function FocusOnChatBoxEvent(chatId:String)
{
super(FOCUS_ON_CHATBOX_EVENT, false, false);
this.chatId = chatId;
}
}
}

View File

@ -0,0 +1,19 @@
package org.bigbluebutton.modules.chat.events
{
import flash.events.Event;
public class GroupChatBoxClosedEvent extends Event
{
public static const CHATBOX_CLOSED_EVENT:String = 'group chat box closed event';
public var chatId: String;
public var windowId: String;
public function GroupChatBoxClosedEvent(chatId:String, windowId:String)
{
super(CHATBOX_CLOSED_EVENT, false, false);
this.chatId = chatId;
this.windowId = windowId;
}
}
}

View File

@ -1,31 +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 <http://www.gnu.org/licenses/>.
*
*/
* 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.modules.chat.events
{
import flash.events.Event;
public class OpenChatBoxEvent extends Event
{
public function OpenChatBoxEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
{
super(type, bubbles, cancelable);
}
}
import flash.events.Event;
public class OpenChatBoxEvent extends Event
{
public static const OPEN_CHATBOX_EVENT:String = "open chat box event";
public var chatId: String;
public function OpenChatBoxEvent(chatId:String)
{
super(OPEN_CHATBOX_EVENT, false, false);
this.chatId = chatId;
}
}
}

View File

@ -35,7 +35,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent;
import org.bigbluebutton.modules.chat.events.CreateGroupChatReqEvent;
import org.bigbluebutton.modules.chat.events.GetWelcomeMessageEvent;
import org.bigbluebutton.modules.chat.events.GroupChatBoxClosedEvent;
import org.bigbluebutton.modules.chat.events.GroupChatCreatedEvent;
import org.bigbluebutton.modules.chat.events.OpenChatBoxEvent;
import org.bigbluebutton.modules.chat.events.ReceivedGroupChatsEvent;
import org.bigbluebutton.modules.chat.events.SendGroupChatMessageEvent;
import org.bigbluebutton.modules.chat.events.SendPrivateChatMessageEvent;
@ -63,6 +65,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{ChatMessageService}" method="handleReceivedGroupChatsEvent" />
</EventHandlers>
<EventHandlers type="{GroupChatBoxClosedEvent.CHATBOX_CLOSED_EVENT}">
<MethodInvoker generator="{ChatEventMapDelegate}" method="chatBoxClosed" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{GroupChatCreatedEvent.GROUP_CHAT_CREATED_EVENT}">
<MethodInvoker generator="{ChatEventMapDelegate}" method="createNewGroupChat" arguments="{event.chatId}"/>
</EventHandlers>
@ -71,6 +77,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<MethodInvoker generator="{ChatEventMapDelegate}" method="closeChatWindows" />
</EventHandlers>
<EventHandlers type="{OpenChatBoxEvent.OPEN_CHATBOX_EVENT}" >
<MethodInvoker generator="{ChatEventMapDelegate}" method="handleOpenChatBoxEvent" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{EventConstants.SEND_PUBLIC_CHAT_REQ}">
<MethodInvoker generator="{ChatMessageService}" method="sendPublicMessageFromApi" arguments="{event.message}"/>
</EventHandlers>
@ -99,7 +110,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<EventHandlers type="{CreateGroupChatReqEvent.CREATE_GROUP_CHAT_REQ_EVENT}" >
<MethodInvoker generator="{ChatMessageService}" method="handleCreateGCReqEvent" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{BBBEvent.RECONNECT_BIGBLUEBUTTON_SUCCEEDED_EVENT}" >
<EventAnnouncer generator="{ChatHistoryEvent}" type="{ChatHistoryEvent.REQUEST_HISTORY}"/>
</EventHandlers>

View File

@ -25,6 +25,9 @@ package org.bigbluebutton.modules.chat.maps {
import org.bigbluebutton.common.events.OpenWindowEvent;
import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.modules.chat.events.FocusOnChatBoxEvent;
import org.bigbluebutton.modules.chat.events.GroupChatBoxClosedEvent;
import org.bigbluebutton.modules.chat.events.OpenChatBoxEvent;
import org.bigbluebutton.modules.chat.events.PrivateGroupChatCreatedEvent;
import org.bigbluebutton.modules.chat.model.ChatModel;
import org.bigbluebutton.modules.chat.model.ChatOptions;
@ -97,10 +100,22 @@ package org.bigbluebutton.modules.chat.maps {
}
}
private function findChatBoxMapper(chatId: String):GroupChatBoxMapper {
for (var i:int=0; i<_windowMapper.length; i++) {
var wMapper: GroupChatWindowMapper = _windowMapper[i];
var gBoxMapper: GroupChatBoxMapper = wMapper.findChatBoxMapper(chatId);
if (gBoxMapper != null) return gBoxMapper;
}
return null;
}
private function openChatBoxForPrivateChat(chatId: String, gc: GroupChat):void {
// Setup a tracker for the state of this chat.
var gcBoxMapper:GroupChatBoxMapper = new GroupChatBoxMapper(chatId);
gcBoxMapper.chatBoxOpen = true;
// By default we put all private chats on the main chat window. (ralam nov 5, 2017)
var winMapper:GroupChatWindowMapper = findGroupChatWindowMapper(MAIN_CHAT_WINID);
winMapper.addChatBox(gcBoxMapper);
@ -136,6 +151,22 @@ package org.bigbluebutton.modules.chat.maps {
}
}
public function handleOpenChatBoxEvent(event: OpenChatBoxEvent):void {
trace("######## handleOpenChatBoxEvent " + event.chatId + " ######");
var gc:GroupChat = LiveMeeting.inst().chats.getGroupChat(event.chatId);
if (gc != null && gc.access == GroupChat.PRIVATE) {
trace("######## FINDING BOX MAPPER FOR " + event.chatId + " ######");
var gboxMapper: GroupChatBoxMapper = findChatBoxMapper(event.chatId);
if (gboxMapper != null) {
trace("######## TODO: BOX MAPPER FOCUS ON " + event.chatId + " ######");
globalDispatcher.dispatchEvent(new FocusOnChatBoxEvent(event.chatId));
} else {
trace("######## BOX MAPPER OPENING ON " + event.chatId + " ######");
openChatBoxForPrivateChat(event.chatId, gc);
}
}
}
private function getChatOptions():void {
chatOptions = Options.getOptions(ChatOptions) as ChatOptions;
}
@ -148,6 +179,21 @@ package org.bigbluebutton.modules.chat.maps {
}
}
public function chatBoxClosed(event: GroupChatBoxClosedEvent):void {
trace("######## chatBoxClosed " + event.chatId + " ######");
var winMapper:GroupChatWindowMapper = findGroupChatWindowMapper(event.windowId);
if (winMapper != null) {
trace("######## chatBoxClosed winMapper " + winMapper.gcWinId + " ######");
var chatBox: GroupChatBoxMapper = winMapper.findChatBoxMapper(event.chatId);
if (chatBox != null) {
trace("********** CLOSING CHAT BOX " + event.chatId);
winMapper.removeChatBox(event.chatId);
} else {
trace("********** COULD NOT FIND CHAT BOX " + event.chatId);
}
}
}
private function openChatWindow(window:ChatWindow):void {
// Use the GLobal Dispatcher so that this message will be heard by the
// main application.

View File

@ -25,8 +25,8 @@ package org.bigbluebutton.modules.chat.maps
_chatBoxes.addItem(box);
}
public function removeChatBox(id: String):void { // never called
for (var i:int=0; i<_chatBoxes.length; i++) {
public function removeChatBox(id: String):void {
for (var i:int=0; i <_chatBoxes.length; i++) {
var box:GroupChatBoxMapper = _chatBoxes.getItemAt(i) as GroupChatBoxMapper;
if (box.chatBoxId == id) {
_chatBoxes.removeItemAt(i);
@ -34,6 +34,17 @@ package org.bigbluebutton.modules.chat.maps
}
}
public function findChatBoxMapper(id: String):GroupChatBoxMapper {
for (var i:int=0; i<_chatBoxes.length; i++) {
var box:GroupChatBoxMapper = _chatBoxes.getItemAt(i) as GroupChatBoxMapper;
if (box.chatBoxId == id) {
return box;
}
}
return null;
}
public function getNumChatBoxes():int {
return _chatBoxes.length;
}

View File

@ -1,35 +1,33 @@
package org.bigbluebutton.modules.chat.model
{
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.modules.chat.events.ConversationDeletedEvent;
import mx.collections.ArrayCollection;
import org.bigbluebutton.modules.chat.events.GroupChatCreatedEvent;
import org.bigbluebutton.modules.chat.events.ReceivedGroupChatsEvent;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
public class ChatModel
{
public static const MAIN_PUBLIC_CHAT:String = 'MAIN-PUBLIC-GROUP-CHAT';
private var convs:Object = new Object();
private var groupChats:Array = [];
private var groupChats:ArrayCollection = new ArrayCollection();
private var dispatcher:Dispatcher = new Dispatcher();
public function getGroupChat(id: String):GroupChat {
if (groupChats.hasOwnProperty(id)) {
return groupChats[id];
}
for (var i:int = 0; i < groupChats.length; i++) {
var gc: GroupChat = groupChats[i] as GroupChat;
if (gc.id == id) return gc;
}
return null;
}
public function getGroupChatIds():Array {
var gcIds: Array = new Array();
for (var id:String in groupChats) {
gcIds.push(id);
for (var i:int = 0; i < groupChats.length; i++) {
var gc: GroupChat = groupChats[i] as GroupChat;
gcIds.push(gc.id);
}
return gcIds;
}
@ -37,73 +35,47 @@ package org.bigbluebutton.modules.chat.model
public function addGroupChatsList(gcs: Array):void {
for (var i: int = 0; i < gcs.length; i++) {
var gc: GroupChat = gcs[i] as GroupChat;
groupChats[gc.id] = gc;
groupChats.addItem(gc);
}
dispatcher.dispatchEvent(new ReceivedGroupChatsEvent());
}
public function getChatConversation(convId:String):ChatConversation {
return null;
}
public function findChatWithUser(userId: String):GroupChat {
trace("######## NUM CHATS " + groupChats.length + " ######" );
for (var i: int = 0; i < groupChats.length; i++) {
var gc: GroupChat = groupChats[i] as GroupChat;
if (gc != null && gc.isChattingWith(userId)) {
trace("######## IS USER " + userId + " ###### IN " + gc.id);
return gc;
}
}
return null;
}
public function addGroupChat(gc: GroupChat):void {
groupChats[gc.id] = gc;
groupChats.addItem(gc);
dispatcher.dispatchEvent(new GroupChatCreatedEvent(gc.id));
}
private function getIndex(id: String):int {
for (var i:int = 0; i < groupChats.length; i++) {
var gc: GroupChat = groupChats[i] as GroupChat;
if (gc.id == id) return i;
}
return -1;
}
public function removeGroupChat(id: String):void {
if (groupChats.hasOwnProperty(id)) {
delete groupChats[id];
}
}
public static function getConvId(from:String, to: String):String {
var members:Array = new Array(to, from);
members.sort();
return members[0] + "-" + members[1];
}
public function newChatMessage(msg:ChatMessageVO):void {
var convId:String = getConvId(msg.fromUserId, msg.toUserId);
if (convs.hasOwnProperty(convId)) {
var cm1:ChatConversation = convs[convId] as ChatConversation;
cm1.newChatMessage(msg);
} else {
var cm2:ChatConversation = new ChatConversation(convId);
cm2.newChatMessage(msg);
convs[convId] = cm2;
for (var i:int = 0; i < groupChats.length; i++) {
var gc: GroupChat = groupChats[i] as GroupChat;
if (gc.id == id) groupChats.removeItemAt(i);
}
}
public function userLeft(userid:String):void {
for (var convId:String in convs){
if (convId.indexOf(userid) > 0) {
delete convs[convId];
dispatcher.dispatchEvent(new ConversationDeletedEvent(convId));
}
}
}
public function getChatConversation(convId:String):ChatConversation {
if (convs.hasOwnProperty(convId)) {
return convs[convId];
} else {
var conv: ChatConversation = new ChatConversation(convId);
convs[convId] = conv;
return conv;
}
}
public static function toChatMessage(rawMessage:Object):ChatMessageVO {
var msg:ChatMessageVO = new ChatMessageVO();
msg.fromUserId = rawMessage.fromUserId;
msg.fromUsername = rawMessage.fromUsername;
msg.fromColor = rawMessage.fromColor;
msg.fromTime = rawMessage.fromTime;
msg.fromTimezoneOffset = rawMessage.fromTimezoneOffset;
msg.toUserId = rawMessage.toUserId;
msg.toUsername = rawMessage.toUsername;
msg.message = rawMessage.message;
return msg;
}
}
}

View File

@ -28,7 +28,8 @@ package org.bigbluebutton.modules.chat.model
private var _dispatcher:Dispatcher = new Dispatcher();
public function GroupChat(id: String, name: String, access: String,
public function GroupChat(id: String,
name: String, access: String,
createdBy: GroupChatUser,
users: ArrayCollection,
msg: ArrayCollection) {
@ -43,11 +44,22 @@ package org.bigbluebutton.modules.chat.model
public function get id():String {
return _id;
}
public function get name(): String {
return _name;
}
public function isChattingWith(userId: String): Boolean {
for (var i:int = 0; i < _users.length; i++) {
var user:GroupChatUser = _users[i] as GroupChatUser;
trace("######## IS CHAT WITH USER? " + userId + " ###### GC USER=" + user.id);
if (user.id == userId) {
return true;
}
}
return false;
}
public function getNameAsUsers(exceptUserId:String):String {
if (users.length == 0) return _name;

View File

@ -18,6 +18,8 @@
*/
package org.bigbluebutton.modules.chat.services
{
import com.asfusion.mate.events.Dispatcher;
import flash.events.IEventDispatcher;
import flash.external.ExternalInterface;
@ -26,6 +28,7 @@ package org.bigbluebutton.modules.chat.services
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.modules.chat.events.CreateGroupChatReqEvent;
import org.bigbluebutton.modules.chat.events.OpenChatBoxEvent;
import org.bigbluebutton.modules.chat.events.SendGroupChatMessageEvent;
import org.bigbluebutton.modules.chat.model.GroupChat;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
@ -38,11 +41,10 @@ package org.bigbluebutton.modules.chat.services
public var sender:MessageSender;
public var receiver:MessageReceiver;
public var dispatcher:IEventDispatcher;
private var globalDispatcher:Dispatcher = new Dispatcher();
public function sendPublicMessageFromApi(event:SendGroupChatMessageEvent):void
{
//sendPublicMessage(event.chatId, msgVO);
}
@ -83,7 +85,25 @@ package org.bigbluebutton.modules.chat.services
}
public function handleCreateGCReqEvent(event:CreateGroupChatReqEvent):void {
sender.createGroupChat(event.name, event.access, event.users);
trace("######## REQUEST TO CREATE NEW GROUP CHAT ######");
// Right now we only support one-to-one private chats)
if (event.access == GroupChat.PRIVATE && event.users.length > 0) {
var chatWith: String = event.users[0] as String;
trace("######## PRIVATE CHAT WITH USER " + chatWith + " ######");
var gc: GroupChat = LiveMeeting.inst().chats.findChatWithUser(chatWith)
if (gc != null) {
// Already chatting with this user. Open the chat box.
trace("######## ALREADY CHATTING WITH USER " + chatWith + " ######");
globalDispatcher.dispatchEvent(new OpenChatBoxEvent(gc.id));
} else {
trace("######## NOT YET CHATTING WITH USER " + chatWith + " ######");
// Not chatting yet with this user.
sender.createGroupChat(event.name, event.access, event.users);
}
} else {
trace("######## PUBLIC CHAT ######");
sender.createGroupChat(event.name, event.access, event.users);
}
}
public function getGroupChats():void {

View File

@ -111,7 +111,8 @@ package org.bigbluebutton.modules.chat.services
var body: Object = msg.body as Object;
var corrId: String = body.correlationId as String;
var chatId: String = body.chatId as String;
var createdBy: GroupChatUser = new GroupChatUser(body.createdBy.id, body.createdBy.name);
var createdBy: GroupChatUser = new GroupChatUser(body.createdBy.id,
body.createdBy.name);
var name: String = body.name as String;
var access: String = body.access as String;
var users: Array = body.users as Array;

View File

@ -26,7 +26,6 @@ package org.bigbluebutton.modules.chat.services
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.managers.ConnectionManager;
import org.bigbluebutton.modules.chat.ChatUtil;
import org.bigbluebutton.modules.chat.model.ChatModel;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
import org.bigbluebutton.modules.chat.vo.GroupChatMsgFromUser;
import org.bigbluebutton.modules.chat.vo.GroupChatUser;

View File

@ -50,13 +50,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flash.events.TextEvent;
import mx.binding.utils.BindingUtils;
import flashx.textLayout.formats.Direction;
import org.as3commons.lang.StringUtils;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
@ -77,7 +73,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.chat.events.GetWelcomeMessageEvent;
import org.bigbluebutton.modules.chat.events.PrivateChatMessageEvent;
import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent;
import org.bigbluebutton.modules.chat.events.SendPrivateChatMessageEvent;
import org.bigbluebutton.modules.chat.events.SendGroupChatMessageEvent;
import org.bigbluebutton.modules.chat.model.ChatConversation;
import org.bigbluebutton.modules.chat.model.ChatModel;
@ -91,6 +86,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
public var chatWithUserID:String;
public var chatWithUsername:String
public var chatId: String = null;
public var parentWindowId:String = null;
public var publicChat: Boolean = false;
public var read:Boolean = true;
public var userHasLeft:Boolean = false;
@ -139,11 +135,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
scrollTimer = new Timer(750, 1);
scrollTimer.addEventListener(TimerEvent.TIMER, onScrollTimer);
// Initialize the indicator for the position in the message history, and add the listener for message history navigation
// Initialize the indicator for the position in the message history,
// and add the listener for message history navigation
currentMessage = -1;
latestMessage = -1;
ResourceUtil.getInstance().addEventListener(Event.CHANGE, localeChanged); // Listen for locale changing
// Listen for locale changing
ResourceUtil.getInstance().addEventListener(Event.CHANGE, localeChanged);
// Listen for the ENTER key to send the message.
txtMsgArea.addEventListener(TextEvent.TEXT_INPUT, handleTextInput);
@ -167,7 +165,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
// chatToolbar.registerListeners(chatMessagesList);
chatMessagesList.addEventListener(ChatEvent.RESIZE_CHAT_TOOLBAR, adjustToolbarWidthAccordingToScrollBar);
chatMessagesList.addEventListener(ChatEvent.RESIZE_CHAT_TOOLBAR,
adjustToolbarWidthAccordingToScrollBar);
}
@ -301,8 +300,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
msg.toUsername = SPACE;
msg.message = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.private.userLeft')+"</b></i>";
var myChat: ChatConversation = LiveMeeting.inst().chats.getChatConversation(id);
myChat.newChatMessage(msg);
var groupChat: GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (groupChat != null) {
groupChat.addMessage(msg);
}
}
private function displayUserHasJoinedMessage():void {
@ -316,8 +317,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
msg.toUsername = SPACE;
msg.message = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.private.userJoined')+"</b></i>";
var myChat: ChatConversation = LiveMeeting.inst().chats.getChatConversation(id);
myChat.newChatMessage(msg);
var groupChat: GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (groupChat != null) {
groupChat.addMessage(msg);
}
}
public function focusToTextMessageArea():void {
@ -326,7 +329,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void {
if (chatId == event.chatId) {
if (chatId == event.chatId && chatMessages != null) {
chatMessages.newChatMessage(event.msg);
scrollToEndOfMessage();
}
@ -376,8 +379,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
msg.toUsername = SPACE;
msg.message = "<b><i>"+ResourceUtil.getInstance().getString('bbb.chat.private.closeMessage', [keyCombo])+"</b></i>";
var myChat: ChatConversation = LiveMeeting.inst().chats.getChatConversation(id);
myChat.newChatMessage(msg);
var groupChat: GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (groupChat != null) {
groupChat.addMessage(msg);
}
}
public function scrollToEndOfMessage():void {
@ -423,12 +428,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function copyAllText():void{
var myChat: ChatConversation = LiveMeeting.inst().chats.getChatConversation(id);
System.setClipboard(myChat.getAllMessageAsString());
var groupChat: GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (groupChat != null) {
System.setClipboard(groupChat.getAllMessageAsString());
}
}
public function getChatId():String {
return id;
return chatId;
}
private function addContextMenuItems():void {
@ -444,8 +451,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function menuItemHandler(e:ContextMenuEvent):void{
if (e.target.caption == ResourceUtil.getInstance().getString("bbb.chat.contextmenu.copyalltext")){
var myChat: ChatConversation = LiveMeeting.inst().chats.getChatConversation(id);
System.setClipboard(myChat.getAllMessageAsString());
var groupChat: GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (groupChat != null) {
System.setClipboard(groupChat.getAllMessageAsString());
}
}
}
@ -513,30 +522,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
globalDispatcher.dispatchEvent(publicEvent);
}
}
private function sendPrivateChatMessage(message:String):void {
var privateEvent:SendPrivateChatMessageEvent = new SendPrivateChatMessageEvent(SendPrivateChatMessageEvent.SEND_PRIVATE_CHAT_MESSAGE_EVENT);
var cm:ChatMessageVO = new ChatMessageVO();
cm.fromUserId = UsersUtil.getMyUserID();
cm.fromUsername = UsersUtil.getMyUsername();
// get the color value from ColorPicker
cm.fromColor = cmpColorPicker.selectedColor.toString();
// Get the current UTC time and the timezone for this sender.
// The receiver will have to convert this to local time.
var now:Date = new Date();
cm.fromTime = now.valueOf();
cm.fromTimezoneOffset = now.getTimezoneOffset();
//cm.message = ChatUtil.parseURLs(ChatUtil.cleanup(message));
cm.message = ExternalInterface.call('parseURLs', (ChatUtil.cleanup(message)));
cm.toUserId = chatWithUserID;
cm.toUsername = chatWithUsername;
privateEvent.chatMessage = cm;
globalDispatcher.dispatchEvent(privateEvent);
}
private function handleTextInput(e:TextEvent):void {
if ((e.text.length == 1) && (e.text.charCodeAt(0) == 10) /*ENTER-KEY*/ && messageCanBeSent) {
sendMessages();
@ -636,12 +622,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function handleClearPublicChatBoxMessages(event:ClearPublicChatEvent):void {
//if(publicChat){
var myChat: ChatConversation = LiveMeeting.inst().chats.getChatConversation(id);
myChat.clearPublicChat();
var groupChat: GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
if (groupChat != null) {
groupChat.clearPublicChat();
invalidateDisplayList();
validateNow();
// }
}
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {

View File

@ -37,7 +37,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{ShortcutEvent.FOCUS_CHAT_TABS}" method="focusChatTabs" />
<mate:Listener type="{ChatToolbarButtonEvent.SAVE_CHAT_TOOLBAR_EVENT}" method="dispatchSaveChatEvent" />
<mate:Listener type="{ChatToolbarButtonEvent.COPY_CHAT_TOOLBAR_EVENT}" method="dispatchCopyChatEvent" />
<mate:Listener type="{ShortcutEvent.CLOSE_PRIVATE}" method="remoteClosePrivate" />
<mate:Listener type="{ShortcutEvent.CLOSE_PRIVATE}" method="remoteClosePrivate" />
<mate:Listener type="{FocusOnChatBoxEvent.FOCUS_ON_CHATBOX_EVENT}" method="handleFocusOnChatBoxEvent" />
</fx:Declarations>
<fx:Script>
@ -64,6 +66,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent;
import org.bigbluebutton.modules.chat.events.ChatSaveEvent;
import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent;
import org.bigbluebutton.modules.chat.events.FocusOnChatBoxEvent;
import org.bigbluebutton.modules.chat.events.GroupChatBoxClosedEvent;
import org.bigbluebutton.modules.chat.events.PrivateChatMessageEvent;
import org.bigbluebutton.modules.chat.events.PrivateGroupChatCreatedEvent;
import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent;
@ -82,8 +86,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var globalDispatcher:Dispatcher = new Dispatcher();
[Bindable] public var chatOptions:ChatOptions;
public var mainChatId: String;
[Bindable] public var mainChatId: String;
public var openTabBox:Boolean = false;
[Bindable] public var windowId:String = ""
private static const PUBLIC_TAB_NEW:String = ResourceUtil.getInstance().getString("bbb.accessibility.chat.chatView.publicTabNew");
private var publicWaiting:Boolean = false;
@ -330,6 +335,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
chatBox.name = groupChatId;
chatBox.chatWithUserID = groupChatId;
chatBox.parentWindowId = windowId;
chatBox.tabIndexer.startIndex = tabIndexer.startIndex + 10;
if (publicChat) {
@ -427,11 +433,26 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function onTabClose(e:SuperTabEvent):void{
trace("########onTabClose REQUEST TO CLOSE CHAT BOX ###### " + e.type);
trace("########onTabClose CLOSE CHAT BOX ######");
var chatBox:ChatBox = chatTabs.getChildAt(e.tabIndex) as ChatBox;
trace("########onTabClose CLOSE CHAT BOX ###### winId="
+ chatBox.parentWindowId + " chatId=" + chatBox.chatId);
dispatchEvent(e);
}
private function onUserClosedTab(e:SuperTabEvent):void{
var name:String = chatTabs.getChildAt(e.tabIndex).name;
trace("######## CLOSE CHAT BOX ######");
var chatBox:ChatBox = chatTabs.getChildAt(e.tabIndex) as ChatBox;
trace("######## CLOSE CHAT BOX ###### winId="
+ chatBox.parentWindowId + " chatId=" + chatBox.chatId);
globalDispatcher.dispatchEvent(new GroupChatBoxClosedEvent(chatBox.chatId,
chatBox.parentWindowId));
}
private function handleFocusOnChatBoxEvent(e:FocusOnChatBoxEvent):void {
trace("######## TODO: handleFocusOnChatBoxEvent CHAT BOX ###### chatId="
+ e.chatId);
}
private function remoteClosePrivate(e:ShortcutEvent):void {

View File

@ -60,7 +60,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var disp:Dispatcher = new Dispatcher();
[Bindable] public var chatOptions:ChatOptions;
private var _windowId: String;
[Bindable] private var _windowId: String;
// The chatId that would be displayed when this window opens.
[Bindable] private var _mainChatId:String;
@ -218,6 +218,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mx:Button id="createGCBtn" label="Create" height="20" click="onCreateGCBtnClick()"
includeInLayout="{_mainChatId == ChatModel.MAIN_PUBLIC_CHAT}"/>
<views:ChatView id="chatView" chatOptions="{chatOptions}" mainChatId="{_mainChatId}"
windowId="{_windowId}"
openTabBox="{_openAddTabBox}" includeInLayout="true"/>
</mx:VBox>

View File

@ -1,12 +1,15 @@
package org.bigbluebutton.modules.polling.service
{
import com.asfusion.mate.events.Dispatcher;
import flash.accessibility.Accessibility;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.modules.chat.model.ChatConversation;
import org.bigbluebutton.modules.chat.model.ChatModel;
import org.bigbluebutton.modules.chat.model.GroupChat;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
import org.bigbluebutton.modules.polling.events.PollShowResultEvent;
import org.bigbluebutton.modules.polling.events.PollStartedEvent;
@ -93,9 +96,10 @@ package org.bigbluebutton.modules.polling.service
pollResultMessage.toUsername = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage");
pollResultMessage.message = accessibleAnswers;
var pubChat: ChatConversation = LiveMeeting.inst().chats.getChatConversation(ChatModel.MAIN_PUBLIC_CHAT);
pubChat.newChatMessage(pollResultMessage);
var groupChat: GroupChat = LiveMeeting.inst().chats.getGroupChat(ChatModel.MAIN_PUBLIC_CHAT);
if (groupChat != null) {
groupChat.addMessage(pollResultMessage);
}
}
}