Merge pull request #4105 from ritzalam/fix-users-chat-list
- display users list for private chat
This commit is contained in:
commit
da9ca0c0ca
@ -30,6 +30,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|||||||
<fx:Declarations>
|
<fx:Declarations>
|
||||||
<mate:Listener type="{LockControlEvent.CHANGED_LOCK_SETTINGS}" method="lockSettingsChanged" />
|
<mate:Listener type="{LockControlEvent.CHANGED_LOCK_SETTINGS}" method="lockSettingsChanged" />
|
||||||
<mate:Listener type="{ChangeMyRole.CHANGE_MY_ROLE_EVENT}" method="refreshRole" />
|
<mate:Listener type="{ChangeMyRole.CHANGE_MY_ROLE_EVENT}" method="refreshRole" />
|
||||||
|
<mate:Listener type="{UserJoinedEvent.JOINED}" method="handleUserJoinedEvent" />
|
||||||
|
<mate:Listener type="{UserLeftEvent.LEFT}" method="handleUserLeftEvent" />
|
||||||
</fx:Declarations>
|
</fx:Declarations>
|
||||||
|
|
||||||
<fx:Script>
|
<fx:Script>
|
||||||
@ -46,6 +48,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|||||||
import org.bigbluebutton.core.events.CoreEvent;
|
import org.bigbluebutton.core.events.CoreEvent;
|
||||||
import org.bigbluebutton.core.events.LockControlEvent;
|
import org.bigbluebutton.core.events.LockControlEvent;
|
||||||
import org.bigbluebutton.core.model.LiveMeeting;
|
import org.bigbluebutton.core.model.LiveMeeting;
|
||||||
|
import org.bigbluebutton.main.events.UserJoinedEvent;
|
||||||
|
import org.bigbluebutton.main.events.UserLeftEvent;
|
||||||
import org.bigbluebutton.main.model.users.events.ChangeMyRole;
|
import org.bigbluebutton.main.model.users.events.ChangeMyRole;
|
||||||
import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent;
|
import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent;
|
||||||
import org.bigbluebutton.modules.chat.events.ChatOptionsEvent;
|
import org.bigbluebutton.modules.chat.events.ChatOptionsEvent;
|
||||||
@ -60,8 +64,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
[Bindable] public var chatOptions:ChatOptions;
|
[Bindable] public var chatOptions:ChatOptions;
|
||||||
|
|
||||||
|
private var handler: ChatWindowEventHandler = new ChatWindowEventHandler();
|
||||||
|
|
||||||
|
private function handleUserLeftEvent(event: UserLeftEvent): void {
|
||||||
|
handler.handleUserLeftEvent(event.userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function handleUserJoinedEvent(event: UserJoinedEvent):void {
|
||||||
|
handler.handleUserJoinedEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
private function onCreationComplete():void{
|
private function onCreationComplete():void{
|
||||||
users = UsersUtil.getUsers();
|
handler.populateAllUsers()
|
||||||
|
users = handler.users;
|
||||||
chatOptions = Options.getOptions(ChatOptions) as ChatOptions;
|
chatOptions = Options.getOptions(ChatOptions) as ChatOptions;
|
||||||
|
|
||||||
if (!chatOptions.privateEnabled) {
|
if (!chatOptions.privateEnabled) {
|
||||||
@ -103,7 +119,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
if (!usersList.visible || !usersList.enabled) return;
|
if (!usersList.visible || !usersList.enabled) return;
|
||||||
|
|
||||||
var chatWithIntId:String = usersList.selectedItem.intId;
|
var chatWithIntId:String = usersList.selectedItem.userId;
|
||||||
|
|
||||||
// Don't want to be chatting with ourself.
|
// Don't want to be chatting with ourself.
|
||||||
if (UsersUtil.isMe(chatWithIntId)) return;
|
if (UsersUtil.isMe(chatWithIntId)) return;
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
package org.bigbluebutton.modules.chat.views
|
||||||
|
{
|
||||||
|
import mx.collections.ArrayCollection;
|
||||||
|
|
||||||
|
import org.bigbluebutton.core.UsersUtil;
|
||||||
|
import org.bigbluebutton.core.model.LiveMeeting;
|
||||||
|
import org.bigbluebutton.core.model.users.User2x;
|
||||||
|
import org.bigbluebutton.main.events.UserJoinedEvent;
|
||||||
|
import org.bigbluebutton.modules.chat.views.model.ChatUser;
|
||||||
|
|
||||||
|
public class ChatWindowEventHandler
|
||||||
|
{
|
||||||
|
[Bindable] public var users:ArrayCollection = new ArrayCollection();
|
||||||
|
|
||||||
|
|
||||||
|
public function ChatWindowEventHandler()
|
||||||
|
{
|
||||||
|
users.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function populateAllUsers():void {
|
||||||
|
getAllWebUsers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getAllWebUsers():void {
|
||||||
|
var userIds: Array = LiveMeeting.inst().users.getUserIds();
|
||||||
|
|
||||||
|
for (var i:int = 0; i < userIds.length; i++) {
|
||||||
|
var userId: String = userIds[i] as String;
|
||||||
|
var user: User2x = UsersUtil.getUser2x(userId);
|
||||||
|
addUser(users, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
users.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleUserJoinedEvent(event: UserJoinedEvent):void {
|
||||||
|
var user: User2x = UsersUtil.getUser(event.userID);
|
||||||
|
if (user != null) {
|
||||||
|
addUser(users, user);
|
||||||
|
users.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function addUser(users: ArrayCollection, user: User2x):void {
|
||||||
|
var buser: ChatUser = new ChatUser();
|
||||||
|
buser.userId = user.intId;
|
||||||
|
buser.name = user.name;
|
||||||
|
|
||||||
|
// We want to remove the user if it's already in the collection and re-add it.
|
||||||
|
removeUser(user.intId, users);
|
||||||
|
|
||||||
|
users.addItem(buser);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function removeUser(userId:String, users: ArrayCollection):void {
|
||||||
|
for (var i:int = 0; i < users.length; i++) {
|
||||||
|
var user:ChatUser = users.getItemAt(i) as ChatUser;
|
||||||
|
if (user.userId == userId) {
|
||||||
|
users.removeItemAt(i);
|
||||||
|
users.refresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleUserLeftEvent(userId: String):void {
|
||||||
|
removeUser(userId, users);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package org.bigbluebutton.modules.chat.views.model
|
||||||
|
{
|
||||||
|
public class ChatUser
|
||||||
|
{
|
||||||
|
public var userId: String;
|
||||||
|
public var name: String;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user