- send message to self when sending private chat

This commit is contained in:
Richard Alam 2012-10-16 21:30:49 +00:00
parent b19a5440b5
commit 314d0edf39
7 changed files with 42 additions and 10 deletions

View File

@ -77,9 +77,11 @@ public class ChatApplication {
}
public void sendPrivateMessage(ChatMessageVO chatobj) {
System.out.println("Sending private chat message to [" + chatobj.toUserID + "]");
ClientMessage m = new ClientMessage(ClientMessage.DIRECT, chatobj.toUserID, "ChatReceivePrivateMessageCommand", chatobj.toMap());
connInvokerService.sendMessage(m);
ClientMessage m2 = new ClientMessage(ClientMessage.DIRECT, chatobj.fromUserID, "ChatReceivePrivateMessageCommand", chatobj.toMap());
connInvokerService.sendMessage(m2);
}
public void setRoomsManager(ChatRoomsManager r) {

View File

@ -85,5 +85,9 @@
<Injectors target="{MessageReceiver}">
<PropertyInjector targetKey="dispatcher" source="{scope.dispatcher}"/>
</Injectors>
<Injectors target="{MessageSender}">
<PropertyInjector targetKey="dispatcher" source="{scope.dispatcher}"/>
</Injectors>
</EventMap>

View File

@ -45,8 +45,7 @@ package org.bigbluebutton.modules.chat.model
cm.translatedColor = uint(msg.fromColor);
cm.senderTime = msg.fromTime;
messages.addItem(cm);
LogUtil.debug("Added chat message. [" + cm.translatedText + "][" + cm.senderText + "]");
messages.addItem(cm);
}
public function getAllMessageAsString():String{

View File

@ -1,5 +1,7 @@
package org.bigbluebutton.modules.chat.services
{
import flash.events.IEventDispatcher;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.managers.ConnectionManager;
@ -7,6 +9,8 @@ package org.bigbluebutton.modules.chat.services
public class MessageSender
{
public var dispatcher:IEventDispatcher;
public function getPublicMessages():void
{
LogUtil.debug("Sending [chat.getPublicMessages] to server.");
@ -51,5 +55,9 @@ package org.bigbluebutton.modules.chat.services
message.toObj()
);
}
private function sendMessageToSelf(message:ChatMessageVO):void {
}
}
}

View File

@ -51,7 +51,7 @@
if (UsersUtil.isMe(chatWithUserID)) return;
usersList.selectedIndex = -1;
chatView.openChatBoxFor(chatWithUserID);
chatView.startPrivateChatWith(chatWithUserID);
}
]]>

View File

@ -160,7 +160,7 @@
private function handlePrivateChatMessageEvent(event:PrivateChatMessageEvent):void {
var message:ChatMessageVO = event.message;
if (!publicChat && message.fromUserID == chatWithUserID) {
if (!publicChat && (message.fromUserID == chatWithUserID || UsersUtil.isMe(message.fromUserID))) {
LogUtil.debug("*** Received PRIVATE Chat Message ****");
chatMessages.newChatMessage(event.message);
scrollToEndOfMessage();

View File

@ -33,23 +33,28 @@
<mx:Script>
<![CDATA[
import be.boulevart.google.ajaxapi.translation.GoogleTranslation;
import be.boulevart.google.events.GoogleApiEvent;
import com.asfusion.mate.events.Dispatcher;
import be.boulevart.google.events.GoogleApiEvent;
import com.asfusion.mate.events.Dispatcher;
import flash.events.FocusEvent;
import flash.external.ExternalInterface;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.utils.Timer;
import flash.utils.Timer;
import flexlib.controls.tabBarClasses.SuperTab;
import flexlib.controls.textClasses.StringBoundaries;
import flexlib.events.SuperTabEvent;
import flexlib.mdi.containers.MDIWindow;
import flexlib.mdi.containers.MDIWindow;
import mx.collections.ArrayCollection;
import mx.containers.ControlBar;
import mx.controls.Button;
import mx.core.Container;
import mx.core.UIComponent;
import mx.events.IndexChangedEvent;
import mx.events.IndexChangedEvent;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.UsersUtil;
@ -121,6 +126,12 @@
}
private function handlePrivateChatMessageEvent(event:PrivateChatMessageEvent):void {
// This message is from me. Ignore as a chatbox has already been created for this
// private chat and that chatbox will handle this message.
if (UsersUtil.isMe(event.message.fromUserID)) return;
// I received a new private chat. Open up a new chatbox and forward the message
// to the chatbox. Succeeding messages will be handled by that chatbox.
if (! userHasChatBox(event.message.fromUserID)) {
// Open a private chat tab.
openChatBoxFor(event.message.fromUserID, false);
@ -128,6 +139,7 @@
getChatBoxForUser(event.message.fromUserID).handleFirstPrivateMessage(event);
}
// See if the chatbox is not in focus and notify user about the message.
notifyUserOfNewMessage(event.message.fromUserID);
}
@ -196,6 +208,13 @@
return chatTabs.getChildByName(userID) as ChatBox;
}
public function startPrivateChatWith(userID:String):void {
openChatBoxFor(userID);
var chatBox:ChatBox = getChatBoxForUser(userID);
var tabIndex:int = getTabIndexFor(chatBox);
chatTabs.selectedIndex = tabIndex;
}
public function openChatBoxFor(chatWithUserID:String, publicChat:Boolean=false):void {
var chatBox:ChatBox;