- propagate public chat to 3rd party

This commit is contained in:
Richard Alam 2012-10-15 21:00:43 +00:00
parent 4ea488b6d0
commit 65dc16646c
3 changed files with 41 additions and 1 deletions

View File

@ -40,6 +40,24 @@ package org.bigbluebutton.main.api
payload.layoutID = layoutID;
broadcastEvent(payload);
}
public function handleNewPublicChatEvent(event:CoreEvent):void {
LogUtil.debug("handleNewPublicChatEvent");
var payload:Object = new Object();
payload.eventName = EventConstants.NEW_PUBLIC_CHAT;
payload.chatType = event.message.chatType;
payload.fromUsername = event.message.fromUsername;
payload.fromColor = event.message.fromColor;
payload.fromLang = event.message.fromLang;
payload.fromTime = event.message.fromTime;
payload.message = event.message.message;
// Need to convert the internal user id to external user id in case the 3rd-party app passed
// an external user id for it's own use.
payload.fromUserID = UsersUtil.internalUserIDToExternalUserID(event.message.fromUserID);
broadcastEvent(payload);
}
public function handleNewPrivateChatEvent(event:CoreEvent):void {
LogUtil.debug("handleNewPrivateChatEvent");

View File

@ -52,5 +52,9 @@
<EventHandlers type="{EventConstants.NEW_PRIVATE_CHAT}" >
<MethodInvoker generator="{ExternalApiCalls}" method="handleNewPrivateChatEvent" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{EventConstants.NEW_PUBLIC_CHAT}" >
<MethodInvoker generator="{ExternalApiCalls}" method="handleNewPublicChatEvent" arguments="{event}"/>
</EventHandlers>
</EventMap>

View File

@ -8,6 +8,7 @@ package org.bigbluebutton.modules.chat.services
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.main.model.users.IMessageListener;
import org.bigbluebutton.modules.chat.events.PrivateChatMessageEvent;
import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent;
import org.bigbluebutton.modules.chat.model.CHAT;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
@ -36,7 +37,24 @@ package org.bigbluebutton.modules.chat.services
private function handleChatReceivePublicMessageCommand(message:Object):void {
LogUtil.debug("Handling public chat message");
// CHAT.getSessions().newPublicChatMessage(message);
var msg:ChatMessageVO = new ChatMessageVO();
msg.chatType = message.chatType;
msg.fromUserID = message.fromUserID;
msg.fromUsername = message.fromUsername;
msg.fromColor = message.fromColor;
msg.fromLang = message.fromLang;
msg.fromTime = message.fromTime;
msg.toUserID = message.toUserID;
msg.toUsername = message.toUsername;
msg.message = message.message;
var pcEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
pcEvent.message = msg;
dispatcher.dispatchEvent(pcEvent);
var pcCoreEvent:CoreEvent = new CoreEvent(EventConstants.NEW_PUBLIC_CHAT);
pcCoreEvent.message = message;
dispatcher.dispatchEvent(pcCoreEvent);
}
private function handleChatReceivePrivateMessageCommand(message:Object):void {