Search in sources :

Example 1 with UndoWhiteboardRequest

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

the class WhiteboardMessageReceiver method handleMessage.

@Override
public void handleMessage(String pattern, String channel, String message) {
    if (channel.equalsIgnoreCase(MessagingConstants.TO_WHITEBOARD_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 (UndoWhiteboardRequest.UNDO_WHITEBOARD_REQUEST.equals(messageName)) {
                    UndoWhiteboardRequest msg = UndoWhiteboardRequest.fromJson(message);
                    bbbInGW.undoWhiteboard(msg.meetingId, msg.requesterId, msg.whiteboardId);
                } else if (ClearWhiteboardRequestMessage.CLEAR_WHITEBOARD_REQUEST.equals(messageName)) {
                    ClearWhiteboardRequestMessage msg = ClearWhiteboardRequestMessage.fromJson(message);
                    bbbInGW.clearWhiteboard(msg.meetingId, msg.requesterId, msg.whiteboardId);
                } else if (RequestWhiteboardAnnotationHistoryRequestMessage.REQUEST_WHITEBOARD_ANNOTATION_HISTORY_REQUEST.equals(messageName)) {
                    RequestWhiteboardAnnotationHistoryRequestMessage msg = RequestWhiteboardAnnotationHistoryRequestMessage.fromJson(message);
                    bbbInGW.requestWhiteboardAnnotationHistory(msg.meetingId, msg.requesterId, msg.whiteboardId, msg.replyTo);
                } else if (IsWhiteboardEnabledRequestMessage.IS_WHITEBOARD_ENABLED_REQUEST.equals(messageName)) {
                    IsWhiteboardEnabledRequestMessage msg = IsWhiteboardEnabledRequestMessage.fromJson(message);
                    bbbInGW.isWhiteboardEnabled(msg.meetingId, msg.requesterId, msg.replyTo);
                } else if (EnableWhiteboardRequestMessage.ENABLE_WHITEBOARD_REQUEST.equals(messageName)) {
                    EnableWhiteboardRequestMessage msg = EnableWhiteboardRequestMessage.fromJson(message);
                    bbbInGW.enableWhiteboard(msg.meetingId, msg.requesterId, msg.enable);
                } else if (SendWhiteboardAnnotationRequestMessage.SEND_WHITEBOARD_ANNOTATION_REQUEST.equals(messageName)) {
                    SendWhiteboardAnnotationRequestMessage msg = SendWhiteboardAnnotationRequestMessage.fromJson(message);
                    bbbInGW.sendWhiteboardAnnotation(msg.meetingId, msg.requesterId, msg.annotation);
                }
            }
        }
    }
}
Also used : EnableWhiteboardRequestMessage(org.bigbluebutton.common.messages.EnableWhiteboardRequestMessage) RequestWhiteboardAnnotationHistoryRequestMessage(org.bigbluebutton.common.messages.RequestWhiteboardAnnotationHistoryRequestMessage) SendWhiteboardAnnotationRequestMessage(org.bigbluebutton.common.messages.SendWhiteboardAnnotationRequestMessage) JsonObject(com.google.gson.JsonObject) UndoWhiteboardRequest(org.bigbluebutton.common.messages.UndoWhiteboardRequest) ClearWhiteboardRequestMessage(org.bigbluebutton.common.messages.ClearWhiteboardRequestMessage) IsWhiteboardEnabledRequestMessage(org.bigbluebutton.common.messages.IsWhiteboardEnabledRequestMessage) JsonParser(com.google.gson.JsonParser)

Aggregations

JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 ClearWhiteboardRequestMessage (org.bigbluebutton.common.messages.ClearWhiteboardRequestMessage)1 EnableWhiteboardRequestMessage (org.bigbluebutton.common.messages.EnableWhiteboardRequestMessage)1 IsWhiteboardEnabledRequestMessage (org.bigbluebutton.common.messages.IsWhiteboardEnabledRequestMessage)1 RequestWhiteboardAnnotationHistoryRequestMessage (org.bigbluebutton.common.messages.RequestWhiteboardAnnotationHistoryRequestMessage)1 SendWhiteboardAnnotationRequestMessage (org.bigbluebutton.common.messages.SendWhiteboardAnnotationRequestMessage)1 UndoWhiteboardRequest (org.bigbluebutton.common.messages.UndoWhiteboardRequest)1