Merge pull request #4454 from ritzalam/implement-multi-chat

- create private and public chats
This commit is contained in:
Richard Alam 2017-10-03 16:43:36 -04:00 committed by GitHub
commit 7975b7da13
6 changed files with 57 additions and 17 deletions

View File

@ -26,7 +26,6 @@ trait CreateGroupChatReqMsgHdlr {
}
}
log.debug("CREATING CHAT ")
val gc = GroupChatApp.createGroupChat(msg.body.name, msg.body.access, createdBy, users, msgs)
sendMessages(msg, gc, liveMeeting, bus)

View File

@ -29,8 +29,6 @@ trait RegisterUserReqMsgHdlr {
msg.body.authed
)
println("********* GUEST MANAGEMENT guestStatus=" + guestStatus + " policy=" + guestPolicy)
val regUser = RegisteredUsers.create(msg.body.intUserId, msg.body.extUserId,
msg.body.name, msg.body.role, msg.body.authToken,
msg.body.avatarURL, msg.body.guest, msg.body.authed, guestStatus)

View File

@ -48,6 +48,20 @@ package org.bigbluebutton.modules.chat.model
return _name;
}
public function getNameAsUsers(exceptUserId:String):String {
if (users.length == 0) return _name;
var tempName:String = "";
for (var i:int = 0; i < _users.length; i++) {
var user:GroupChatUser = _users[i] as GroupChatUser;
if (user.id != exceptUserId) {
tempName += user.name + ",";
}
}
return tempName.slice(0,-1);
}
public function get access(): String {
return _access;
}
@ -78,7 +92,6 @@ package org.bigbluebutton.modules.chat.model
}
}
trace("RECEIVED CHAT HISTORY FROM SERVER FOR CHAT = " + _id);
var chEvent:ChatHistoryEvent = new ChatHistoryEvent(ChatHistoryEvent.RECEIVED_HISTORY);
chEvent.chatId = id;
_dispatcher.dispatchEvent(chEvent);

View File

@ -37,9 +37,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.CloseEvent;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.EventConstants;
@ -54,7 +56,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent;
import org.bigbluebutton.modules.chat.events.ChatOptionsEvent;
import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent;
import org.bigbluebutton.modules.chat.events.CreateGroupChatReqEvent;
import org.bigbluebutton.modules.chat.model.ChatOptions;
import org.bigbluebutton.modules.chat.model.GroupChat;
import org.bigbluebutton.modules.chat.views.model.ChatUser;
import org.bigbluebutton.util.i18n.ResourceUtil;
private static const LOGGER:ILogger = getClassLogger(AddChatTabBox);
@ -77,13 +82,29 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handleUserJoinedEvent(event: UserJoinedEvent):void {
handler.handleUserJoinedEvent(event);
handler.populateAllUsers()
users = removeMe(handler.users);
}
private function removeMe(users:ArrayCollection):ArrayCollection {
var myUserId:String = UsersUtil.getMyUserID();
var filteredUsers:Array = new Array();
for (var i:int = 0; i < users.length; i++) {
var user:ChatUser = users[i] as ChatUser;
if (user.userId != myUserId) {
filteredUsers.push(user);
}
}
return new ArrayCollection(filteredUsers);
}
private function onCreationComplete():void{
clrBtnVisible = UsersUtil.amIModerator();
handler.populateAllUsers()
users = handler.users;
users = removeMe(handler.users);
chatOptions = Options.getOptions(ChatOptions) as ChatOptions;
if (!chatOptions.privateEnabled) {
@ -132,10 +153,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
usersList.selectedIndex = -1;
var e:CoreEvent = new CoreEvent(EventConstants.START_PRIVATE_CHAT);
e.message.chatWith = chatWithIntId;
var gd:Dispatcher = new Dispatcher();
gd.dispatchEvent(e);
var testChatName:String = "Test Private Chat";
var access:String = GroupChat.PRIVATE;
var users:Array = new Array();
users.push(chatWithIntId);
var createEvent:CreateGroupChatReqEvent =
new CreateGroupChatReqEvent(testChatName, access, users);
globalDispatcher.dispatchEvent(createEvent);
}

View File

@ -58,6 +58,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.modules.chat.events.ChatCopyEvent;
import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent;
@ -321,7 +322,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
return getChatBoxForUser(groupChatId);
} else {
return createChatBoxFor(groupChatId, publicChat);
}
}
}
private function createChatBoxFor(groupChatId:String, publicChat:Boolean = false):ChatBox {
@ -337,10 +338,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
chatBox.publicChat = true;
publicBox = chatBox; // keep a reference to the public chat box
} else {
chatBox.chatId = groupChatId;
chatBox.publicChat = false;
chatBox.label = "FOO CHAT";
chatBox.displayHowToCloseMessage();
var gc:GroupChat = LiveMeeting.inst().chats.getGroupChat(groupChatId);
if (gc != null) {
chatBox.chatId = groupChatId;
chatBox.publicChat = false;
// We want to display other user's name without ours.
chatBox.label = gc.getNameAsUsers(UsersUtil.getMyUserID());
chatBox.displayHowToCloseMessage();
}
}
chatBox.chatWithUsername = groupChatId;

View File

@ -199,9 +199,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
public function onCreateGCBtnClick():void {
var testChatName:String = "Test Private Chat";
var access:String = GroupChat.PRIVATE;
var users:Array = LiveMeeting.inst().users.getUserIds();
var testChatName:String = "New Public Chat";
var access:String = GroupChat.PUBLIC;
var users:Array = new Array();
var createEvent:CreateGroupChatReqEvent =
new CreateGroupChatReqEvent(testChatName, access, users);