Search in sources :

Example 1 with UpdateCaptionOwnerMessage

use of org.bigbluebutton.common.messages.UpdateCaptionOwnerMessage in project bigbluebutton by bigbluebutton.

the class CaptionClientMessageSender method handleCaptionMessage.

public void handleCaptionMessage(String message) {
    JsonParser parser = new JsonParser();
    JsonObject obj = (JsonObject) parser.parse(message);
    if (obj.has("header") && obj.has("payload")) {
        JsonObject header = (JsonObject) obj.get("header");
        if (header.has("name")) {
            String messageName = header.get("name").getAsString();
            switch(messageName) {
                case SendCaptionHistoryReplyMessage.SEND_CAPTION_HISTORY_REPLY:
                    SendCaptionHistoryReplyMessage sch = SendCaptionHistoryReplyMessage.fromJson(message);
                    if (sch != null) {
                        processSendCaptionHistoryReplyMessage(sch);
                    }
                    break;
                case UpdateCaptionOwnerMessage.UPDATE_CAPTION_OWNER:
                    UpdateCaptionOwnerMessage uco = UpdateCaptionOwnerMessage.fromJson(message);
                    if (uco != null) {
                        processUpdateCaptionOwnerMessage(uco);
                    }
                    break;
                case EditCaptionHistoryMessage.EDIT_CAPTION_HISTORY:
                    EditCaptionHistoryMessage ech = EditCaptionHistoryMessage.fromJson(message);
                    if (ech != null) {
                        processEditCaptionHistoryMessage(ech);
                    }
                    break;
            }
        }
    }
}
Also used : UpdateCaptionOwnerMessage(org.bigbluebutton.common.messages.UpdateCaptionOwnerMessage) JsonObject(com.google.gson.JsonObject) SendCaptionHistoryReplyMessage(org.bigbluebutton.common.messages.SendCaptionHistoryReplyMessage) EditCaptionHistoryMessage(org.bigbluebutton.common.messages.EditCaptionHistoryMessage) JsonParser(com.google.gson.JsonParser)

Example 2 with UpdateCaptionOwnerMessage

use of org.bigbluebutton.common.messages.UpdateCaptionOwnerMessage in project bigbluebutton by bigbluebutton.

the class CaptionMessageReceiver method handleMessage.

@Override
public void handleMessage(String pattern, String channel, String message) {
    if (channel.equalsIgnoreCase(MessagingConstants.TO_CAPTION_CHANNEL)) {
        JsonParser parser = new JsonParser();
        JsonObject obj = (JsonObject) parser.parse(message);
        if (obj.has("header") && obj.has("payload")) {
            JsonObject header = (JsonObject) obj.get("header");
            if (header.has("name")) {
                String messageName = header.get("name").getAsString();
                if (SendCaptionHistoryRequestMessage.SEND_CAPTION_HISTORY_REQUEST.equals(messageName)) {
                    SendCaptionHistoryRequestMessage msg = SendCaptionHistoryRequestMessage.fromJson(message);
                    bbbGW.sendCaptionHistory(msg.meetingID, msg.requesterID);
                } else if (UpdateCaptionOwnerMessage.UPDATE_CAPTION_OWNER.equals(messageName)) {
                    UpdateCaptionOwnerMessage msg = UpdateCaptionOwnerMessage.fromJson(message);
                    bbbGW.updateCaptionOwner(msg.meetingID, msg.locale, msg.localeCode, msg.ownerID);
                } else if (EditCaptionHistoryMessage.EDIT_CAPTION_HISTORY.equals(messageName)) {
                    EditCaptionHistoryMessage msg = EditCaptionHistoryMessage.fromJson(message);
                    bbbGW.editCaptionHistory(msg.meetingID, msg.userID, msg.startIndex, msg.endIndex, msg.locale, msg.localeCode, msg.text);
                }
            }
        }
    }
}
Also used : SendCaptionHistoryRequestMessage(org.bigbluebutton.common.messages.SendCaptionHistoryRequestMessage) UpdateCaptionOwnerMessage(org.bigbluebutton.common.messages.UpdateCaptionOwnerMessage) JsonObject(com.google.gson.JsonObject) EditCaptionHistoryMessage(org.bigbluebutton.common.messages.EditCaptionHistoryMessage) JsonParser(com.google.gson.JsonParser)

Aggregations

JsonObject (com.google.gson.JsonObject)2 JsonParser (com.google.gson.JsonParser)2 EditCaptionHistoryMessage (org.bigbluebutton.common.messages.EditCaptionHistoryMessage)2 UpdateCaptionOwnerMessage (org.bigbluebutton.common.messages.UpdateCaptionOwnerMessage)2 SendCaptionHistoryReplyMessage (org.bigbluebutton.common.messages.SendCaptionHistoryReplyMessage)1 SendCaptionHistoryRequestMessage (org.bigbluebutton.common.messages.SendCaptionHistoryRequestMessage)1