From 9302532be592babb3b86a0789dac9691099b4b10 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Thu, 13 Aug 2015 22:33:51 +0000 Subject: [PATCH 1/2] - start implementing custom poll --- akka-bbb-apps/build.sbt | 2 +- .../core/api/IBigBlueButtonInGW.java | 4 +- .../receivers/MeetingMessageReceiver.java | 6 +-- .../receivers/PollingMessageReceiver.java | 5 +++ .../core/BigBlueButtonInGW.scala | 8 ++++ .../endpoint/redis/RedisPublisher.scala | 2 +- bbb-common-message/build.sbt | 11 +++-- .../AssignPresenterRequestMessage.java | 2 +- .../common/messages/CreateMeetingMessage.java | 2 +- .../messages/DestroyMeetingMessage.java | 2 +- .../messages/DisconnectAllUsersMessage.java | 2 +- .../messages/DisconnectUserMessage.java | 2 +- .../common/messages/EndMeetingMessage.java | 2 +- .../messages/GetAllMeetingsRequest.java | 2 +- .../common/messages/GetChatHistory.java | 2 +- .../GetChatHistoryRequestMessage.java | 2 +- .../messages/GetLockSettingsMessage.java | 2 +- .../messages/GetPresentationInfoMessage.java | 2 +- .../GetPresentationInfoReplyMessage.java | 2 +- .../common/messages/GetSlideInfoMessage.java | 2 +- .../messages/GetUsersRequestMessage.java | 2 +- .../common/messages/GoToSlideMessage.java | 2 +- ...essage.java => IBigBlueButtonMessage.java} | 2 +- .../common/messages/KeepAliveMessage.java | 2 +- .../common/messages/LockUserMessage.java | 2 +- .../messages/MessageFromJsonConverter.java | 12 ++--- .../common/messages/MessageHeader.java | 10 +++++ .../common/messages/RegisterUserMessage.java | 2 +- .../messages/RemovePresentationMessage.java | 2 +- .../messages/ResizeAndMoveSlideMessage.java | 2 +- .../SendConversionCompletedMessage.java | 2 +- .../messages/SendConversionUpdateMessage.java | 2 +- .../messages/SendCursorUpdateMessage.java | 2 +- .../messages/SendLockSettingsMessage.java | 2 +- .../messages/SendPageCountErrorMessage.java | 2 +- .../messages/SendPrivateChatMessage.java | 2 +- .../messages/SendPublicChatMessage.java | 2 +- .../messages/SendSlideGeneratedMessage.java | 2 +- .../messages/SharePresentationMessage.java | 2 +- .../StartCustomPollRequestMessage.java | 9 ++++ .../StartCustomPollRequestMessagePayload.java | 11 +++++ .../messages/UserConnectedToGlobalAudio.java | 2 +- .../UserDisconnectedFromGlobalAudio.java | 2 +- .../messages/ValidateAuthTokenMessage.java | 2 +- .../StartCustomPollRequestMessageTest.java | 45 +++++++++++++++++++ bigbluebutton-apps/build.gradle | 2 +- .../red5/pubsub/MessagePublisher.java | 5 ++- .../red5/service/PollingService.java | 7 +++ 48 files changed, 154 insertions(+), 51 deletions(-) rename bbb-common-message/src/main/java/org/bigbluebutton/common/messages/{IPublishedMessage.java => IBigBlueButtonMessage.java} (50%) create mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageHeader.java create mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessage.java create mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java create mode 100755 bbb-common-message/src/test/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessageTest.java diff --git a/akka-bbb-apps/build.sbt b/akka-bbb-apps/build.sbt index 1447268cf6..20f27ebce3 100755 --- a/akka-bbb-apps/build.sbt +++ b/akka-bbb-apps/build.sbt @@ -50,7 +50,7 @@ libraryDependencies ++= { "com.google.code.gson" % "gson" % "1.7.1", "redis.clients" % "jedis" % "2.1.0", "org.apache.commons" % "commons-lang3" % "3.2", - "org.bigbluebutton" % "bbb-common-message" % "0.0.11" + "org.bigbluebutton" % "bbb-common-message" % "0.0.12-SNAPSHOT" )} diff --git a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java index d7c0b3aafc..8557cf8f77 100755 --- a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java +++ b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -1,10 +1,12 @@ package org.bigbluebutton.core.api; import java.util.Map; - +import org.bigbluebutton.common.messages.*; public interface IBigBlueButtonInGW { + void handleBigBlueButtonMessage(IBigBlueButtonMessage message); + void isAliveAudit(String aliveID); void statusMeetingAudit(String meetingID); void endMeeting(String meetingID); diff --git a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java index 463542f7f2..eca1655124 100755 --- a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java +++ b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/MeetingMessageReceiver.java @@ -6,7 +6,7 @@ import org.bigbluebutton.common.messages.CreateMeetingMessage; import org.bigbluebutton.common.messages.DestroyMeetingMessage; import org.bigbluebutton.common.messages.EndMeetingMessage; import org.bigbluebutton.common.messages.GetAllMeetingsRequest; -import org.bigbluebutton.common.messages.IPublishedMessage; +import org.bigbluebutton.common.messages.IBigBlueButtonMessage; import org.bigbluebutton.common.messages.KeepAliveMessage; import org.bigbluebutton.common.messages.MessageFromJsonConverter; import org.bigbluebutton.common.messages.MessagingConstants; @@ -33,7 +33,7 @@ public class MeetingMessageReceiver implements MessageHandler { // LOG.debug("Checking message: " + pattern + " " + channel + " " + message); if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) { // System.out.println("Meeting message: " + channel + " " + message); - IPublishedMessage msg = MessageFromJsonConverter.convert(message); + IBigBlueButtonMessage msg = MessageFromJsonConverter.convert(message); if (msg != null) { if (msg instanceof EndMeetingMessage) { @@ -96,7 +96,7 @@ public class MeetingMessageReceiver implements MessageHandler { System.out.println("Failed to decode message: [" + message + "]"); } } else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) { - IPublishedMessage msg = MessageFromJsonConverter.convert(message); + IBigBlueButtonMessage msg = MessageFromJsonConverter.convert(message); if (msg != null) { if (msg instanceof KeepAliveMessage) { diff --git a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PollingMessageReceiver.java b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PollingMessageReceiver.java index 1b66b21387..72cdd2586a 100755 --- a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PollingMessageReceiver.java +++ b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/PollingMessageReceiver.java @@ -2,6 +2,7 @@ package org.bigbluebutton.core.pubsub.receivers; import org.bigbluebutton.common.messages.*; +import com.google.gson.Gson; import com.google.gson.JsonParser; import com.google.gson.JsonObject; @@ -40,6 +41,10 @@ public class PollingMessageReceiver implements MessageHandler{ } else if (ShowPollResultRequestMessage.SHOW_POLL_RESULT_REQUEST.equals(messageName)){ ShowPollResultRequestMessage msg = ShowPollResultRequestMessage.fromJson(message); bbbGW.showPollResult(msg.meetingId, msg.requesterId, msg.pollId, msg.show); + } else if (StartCustomPollRequestMessage.START_CUSTOM_POLL_REQUEST.equals(messageName)){ + Gson gson = new Gson(); + StartCustomPollRequestMessage msg = gson.fromJson(message, StartCustomPollRequestMessage.class); + bbbGW.handleBigBlueButtonMessage(msg); } } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala index f029761d94..3341ef2f2e 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -15,11 +15,19 @@ import scala.concurrent.duration._ import scala.util.Success import scala.util.Failure import org.bigbluebutton.core.service.recorder.RecorderApplication +import org.bigbluebutton.common.messages.IBigBlueButtonMessage; +import org.bigbluebutton.common.messages.StartCustomPollRequestMessage class BigBlueButtonInGW(val system: ActorSystem, recorderApp: RecorderApplication, messageSender: MessageSender, voiceEventRecorder: VoiceEventRecorder) extends IBigBlueButtonInGW { val log = system.log val bbbActor = system.actorOf(BigBlueButtonActor.props(system, recorderApp, messageSender, voiceEventRecorder), "bigbluebutton-actor") + def handleBigBlueButtonMessage(message: IBigBlueButtonMessage) { + if (message.isInstanceOf[StartCustomPollRequestMessage]) { + + } + } + // Meeting def createMeeting2(meetingID: String, externalMeetingID: String, meetingName: String, record: Boolean, voiceBridge: String, duration: Long, autoStartRecording: Boolean, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala index 96d1b04d29..3291a0e6bc 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisPublisher.scala @@ -26,7 +26,7 @@ class RedisPublisher(val system: ActorSystem) extends SystemConfiguration { // system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value")) def publish(channel: String, data: String) { - // println("PUBLISH TO [" + channel + "]: \n [" + data + "]") + println("PUBLISH TO [" + channel + "]: \n [" + data + "]") redis.publish(channel, data) } diff --git a/bbb-common-message/build.sbt b/bbb-common-message/build.sbt index 4815a5f78a..0bf74d8d2b 100755 --- a/bbb-common-message/build.sbt +++ b/bbb-common-message/build.sbt @@ -4,7 +4,7 @@ name := "bbb-common-message" organization := "org.bigbluebutton" -version := "0.0.11" +version := "0.0.12-SNAPSHOT" // We want to have our jar files in lib_managed dir. // This way we'll have the right path when we import @@ -20,6 +20,9 @@ libraryDependencies ++= { "com.google.code.gson" % "gson" % "1.7.1" )} +libraryDependencies += "junit" % "junit" % "4.11" % "test" +libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test" + seq(Revolver.settings: _*) //----------- @@ -45,12 +48,12 @@ autoScalaLibrary := false * publish to the local maven repo using "sbt publish" */ // Uncomment this to publish to local maven repo while commenting out the nexus repo -//publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository"))) +publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository"))) // Comment this out when publishing to local maven repo using SNAPSHOT version. // To push to sonatype "sbt publishSigned" - +/* publishTo := { val nexus = "https://oss.sonatype.org/" if (isSnapshot.value) @@ -58,7 +61,7 @@ publishTo := { else Some("releases" at nexus + "service/local/staging/deploy/maven2") } - +*/ // Enables publishing to maven repo publishMavenStyle := true diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java index 891e36bcbb..c26f165335 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/AssignPresenterRequestMessage.java @@ -4,7 +4,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class AssignPresenterRequestMessage implements IPublishedMessage { +public class AssignPresenterRequestMessage implements IBigBlueButtonMessage { public static final String ASSIGN_PRESENTER_REQUEST = "assign_presenter_request_message"; public final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java index 461c0d283f..583b3fe2a4 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/CreateMeetingMessage.java @@ -1,6 +1,6 @@ package org.bigbluebutton.common.messages; -public class CreateMeetingMessage implements IPublishedMessage { +public class CreateMeetingMessage implements IBigBlueButtonMessage { public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java index 4e040e4f4b..dcac835b10 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DestroyMeetingMessage.java @@ -1,6 +1,6 @@ package org.bigbluebutton.common.messages; -public class DestroyMeetingMessage implements IPublishedMessage { +public class DestroyMeetingMessage implements IBigBlueButtonMessage { public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java index b95f3ad719..78f2f3d9b6 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectAllUsersMessage.java @@ -4,7 +4,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class DisconnectAllUsersMessage implements IPublishedMessage { +public class DisconnectAllUsersMessage implements IBigBlueButtonMessage { public static final String DISCONNECT_All_USERS = "disconnect_all_users_message"; public final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java index 4d21a7e51f..b0078b275e 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/DisconnectUserMessage.java @@ -4,7 +4,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class DisconnectUserMessage implements IPublishedMessage { +public class DisconnectUserMessage implements IBigBlueButtonMessage { public static final String DISCONNECT_USER = "disconnect_user_message"; public final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java index f2aa8d2df9..a5efc2d3d6 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/EndMeetingMessage.java @@ -1,6 +1,6 @@ package org.bigbluebutton.common.messages; -public class EndMeetingMessage implements IPublishedMessage { +public class EndMeetingMessage implements IBigBlueButtonMessage { public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java index f4d321f357..deac4db279 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetAllMeetingsRequest.java @@ -1,6 +1,6 @@ package org.bigbluebutton.common.messages; -public class GetAllMeetingsRequest implements IPublishedMessage { +public class GetAllMeetingsRequest implements IBigBlueButtonMessage { public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java index d034eb4c1d..36390c3e04 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GetChatHistory implements IPublishedMessage { +public class GetChatHistory implements IBigBlueButtonMessage { public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java index 8f820ca2e6..8294876ad2 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java @@ -3,7 +3,7 @@ package org.bigbluebutton.common.messages; import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GetChatHistoryRequestMessage implements IPublishedMessage { +public class GetChatHistoryRequestMessage implements IBigBlueButtonMessage { public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java index 6b164e75cf..0f4c711012 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetLockSettingsMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GetLockSettingsMessage implements IPublishedMessage { +public class GetLockSettingsMessage implements IBigBlueButtonMessage { public static final String GET_LOCK_SETTINGS = "get_lock_settings"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java index e25af38764..473c2bef54 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GetPresentationInfoMessage implements IPublishedMessage { +public class GetPresentationInfoMessage implements IBigBlueButtonMessage { public static final String GET_PRESENTATION_INFO = "get_presentation_info"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java index 155d28444f..7fba5d6652 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetPresentationInfoReplyMessage.java @@ -8,7 +8,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GetPresentationInfoReplyMessage implements IPublishedMessage { +public class GetPresentationInfoReplyMessage implements IBigBlueButtonMessage { public static final String GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java index 78015ec8b4..69170a8a9b 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetSlideInfoMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GetSlideInfoMessage implements IPublishedMessage { +public class GetSlideInfoMessage implements IBigBlueButtonMessage { public static final String GET_SLIDE_INFO = "get_slide_info"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java index 4c377f7d99..eb9b2afc4e 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetUsersRequestMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GetUsersRequestMessage implements IPublishedMessage { +public class GetUsersRequestMessage implements IBigBlueButtonMessage { public static final String GET_USERS_REQUEST = "get_users_request_message"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java index 4717d91b3f..17a7ed03fc 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GoToSlideMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class GoToSlideMessage implements IPublishedMessage { +public class GoToSlideMessage implements IBigBlueButtonMessage { public static final String GO_TO_SLIDE = "go_to_slide"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/IPublishedMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/IBigBlueButtonMessage.java similarity index 50% rename from bbb-common-message/src/main/java/org/bigbluebutton/common/messages/IPublishedMessage.java rename to bbb-common-message/src/main/java/org/bigbluebutton/common/messages/IBigBlueButtonMessage.java index 649f395876..e8a34b51ad 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/IPublishedMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/IBigBlueButtonMessage.java @@ -1,5 +1,5 @@ package org.bigbluebutton.common.messages; -public interface IPublishedMessage { +public interface IBigBlueButtonMessage { } diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java index 059211e811..dfdb457de4 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/KeepAliveMessage.java @@ -1,6 +1,6 @@ package org.bigbluebutton.common.messages; -public class KeepAliveMessage implements IPublishedMessage { +public class KeepAliveMessage implements IBigBlueButtonMessage { public static final String KEEP_ALIVE_REQUEST = "keep_alive_request"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java index 02276a2060..2c5fcffa1b 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/LockUserMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class LockUserMessage implements IPublishedMessage { +public class LockUserMessage implements IBigBlueButtonMessage { public static final String LOCK_USER = "lock_user"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java index 5b512e925b..11292043bb 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageFromJsonConverter.java @@ -5,7 +5,7 @@ import com.google.gson.JsonParser; public class MessageFromJsonConverter { - public static IPublishedMessage convert(String message) { + public static IBigBlueButtonMessage convert(String message) { JsonParser parser = new JsonParser(); JsonObject obj = (JsonObject) parser.parse(message); @@ -41,7 +41,7 @@ public class MessageFromJsonConverter { return null; } - private static IPublishedMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) { + private static IBigBlueButtonMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) { String id = payload.get(Constants.MEETING_ID).getAsString(); String userid = payload.get(Constants.USER_ID).getAsString(); String authToken = payload.get(Constants.AUTH_TOKEN).getAsString(); @@ -51,7 +51,7 @@ public class MessageFromJsonConverter { sessionId); } - private static IPublishedMessage processCreateMeeting(JsonObject payload) { + private static IBigBlueButtonMessage processCreateMeeting(JsonObject payload) { String id = payload.get(Constants.MEETING_ID).getAsString(); String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString(); String name = payload.get(Constants.NAME).getAsString(); @@ -70,17 +70,17 @@ public class MessageFromJsonConverter { moderatorPassword, viewerPassword, createTime, createDate); } - private static IPublishedMessage processDestroyMeeting(JsonObject payload) { + private static IBigBlueButtonMessage processDestroyMeeting(JsonObject payload) { String id = payload.get(Constants.MEETING_ID).getAsString(); return new DestroyMeetingMessage(id); } - private static IPublishedMessage processEndMeetingMessage(JsonObject payload) { + private static IBigBlueButtonMessage processEndMeetingMessage(JsonObject payload) { String id = payload.get(Constants.MEETING_ID).getAsString(); return new EndMeetingMessage(id); } - private static IPublishedMessage processKeepAlive(JsonObject payload) { + private static IBigBlueButtonMessage processKeepAlive(JsonObject payload) { String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString(); return new KeepAliveMessage(id); } diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageHeader.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageHeader.java new file mode 100755 index 0000000000..e82e4e358c --- /dev/null +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessageHeader.java @@ -0,0 +1,10 @@ +package org.bigbluebutton.common.messages; + +public class MessageHeader { + + public String name; + public String version; + public Long timestamp; + public String replyTo; + +} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java index 78738fab6c..5e74558fab 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RegisterUserMessage.java @@ -4,7 +4,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class RegisterUserMessage implements IPublishedMessage { +public class RegisterUserMessage implements IBigBlueButtonMessage { public static final String REGISTER_USER = "register_user_request"; public final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java index 4fc04a91c1..d22fb9776d 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/RemovePresentationMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class RemovePresentationMessage implements IPublishedMessage { +public class RemovePresentationMessage implements IBigBlueButtonMessage { public static final String REMOVE_PRESENTATION = "remove_presentation"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java index c82cdb50cc..16a2cf6553 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ResizeAndMoveSlideMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class ResizeAndMoveSlideMessage implements IPublishedMessage { +public class ResizeAndMoveSlideMessage implements IBigBlueButtonMessage { public static final String RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java index 6f7cdad54c..593de02722 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionCompletedMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendConversionCompletedMessage implements IPublishedMessage { +public class SendConversionCompletedMessage implements IBigBlueButtonMessage { public static final String SEND_CONVERSION_COMPLETED = "send_conversion_completed"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java index 58b6d987c8..a5a07a8608 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendConversionUpdateMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendConversionUpdateMessage implements IPublishedMessage { +public class SendConversionUpdateMessage implements IBigBlueButtonMessage { public static final String SEND_CONVERSION_UPDATE = "send_conversion_update"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java index c81e8e3ec3..bb11902959 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendCursorUpdateMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendCursorUpdateMessage implements IPublishedMessage { +public class SendCursorUpdateMessage implements IBigBlueButtonMessage { public static final String SEND_CURSOR_UPDATE = "send_cursor_update"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java index a986d31220..82000311a2 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendLockSettingsMessage.java @@ -6,7 +6,7 @@ import java.util.Map; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendLockSettingsMessage implements IPublishedMessage { +public class SendLockSettingsMessage implements IBigBlueButtonMessage { public static final String SEND_LOCK_SETTINGS = "send_lock_settings"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java index 3adc9fa711..f2680994a9 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPageCountErrorMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendPageCountErrorMessage implements IPublishedMessage { +public class SendPageCountErrorMessage implements IBigBlueButtonMessage { public static final String SEND_PAGE_COUNT_ERROR = "send_page_count_error"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java index 35dcadcf76..60262dd097 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java @@ -5,7 +5,7 @@ import java.util.Map; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendPrivateChatMessage implements IPublishedMessage { +public class SendPrivateChatMessage implements IBigBlueButtonMessage { public static final String SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java index b937264317..ec9f1c30eb 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java @@ -5,7 +5,7 @@ import java.util.Map; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendPublicChatMessage implements IPublishedMessage { +public class SendPublicChatMessage implements IBigBlueButtonMessage { public static final String SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java index bc325b130f..6d8db8255b 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendSlideGeneratedMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SendSlideGeneratedMessage implements IPublishedMessage { +public class SendSlideGeneratedMessage implements IBigBlueButtonMessage { public static final String SEND_SLIDE_GENERATED = "send_slide_generated"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java index cf4c114d9f..36f07847f0 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SharePresentationMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class SharePresentationMessage implements IPublishedMessage { +public class SharePresentationMessage implements IBigBlueButtonMessage { public static final String SHARE_PRESENTATION = "share_presentation"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessage.java new file mode 100755 index 0000000000..c0a99875d0 --- /dev/null +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessage.java @@ -0,0 +1,9 @@ +package org.bigbluebutton.common.messages; + +public class StartCustomPollRequestMessage implements IBigBlueButtonMessage { + + public static final String START_CUSTOM_POLL_REQUEST = "start_custom_poll_request_message"; + + public MessageHeader header; + public StartCustomPollRequestMessagePayload payload; +} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java new file mode 100755 index 0000000000..5565ffe125 --- /dev/null +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java @@ -0,0 +1,11 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; + +public class StartCustomPollRequestMessagePayload { + public String pollType; + public ArrayList answers; + public String pollId; + public String requesterId; + +} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java index a58cec926e..5b368ae46f 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserConnectedToGlobalAudio.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class UserConnectedToGlobalAudio implements IPublishedMessage { +public class UserConnectedToGlobalAudio implements IBigBlueButtonMessage { public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java index 95218e2787..eb5742e2e0 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/UserDisconnectedFromGlobalAudio.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class UserDisconnectedFromGlobalAudio implements IPublishedMessage { +public class UserDisconnectedFromGlobalAudio implements IBigBlueButtonMessage { public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java index 5ea99f4d37..997e940b4b 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ValidateAuthTokenMessage.java @@ -5,7 +5,7 @@ import java.util.HashMap; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -public class ValidateAuthTokenMessage implements IPublishedMessage { +public class ValidateAuthTokenMessage implements IBigBlueButtonMessage { public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token"; public static final String VERSION = "0.0.1"; diff --git a/bbb-common-message/src/test/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessageTest.java b/bbb-common-message/src/test/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessageTest.java new file mode 100755 index 0000000000..d57e074a4b --- /dev/null +++ b/bbb-common-message/src/test/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessageTest.java @@ -0,0 +1,45 @@ +package org.bigbluebutton.common.messages; + +import java.util.ArrayList; + +import org.junit.*; + +import com.google.gson.Gson; + +public class StartCustomPollRequestMessageTest { + + @Test + public void testStartCustomPollRequestMessage() { + System.out.println("FOOO!"); + + StartCustomPollRequestMessage msg = new StartCustomPollRequestMessage(); + MessageHeader header = new MessageHeader(); + header.name = "start_custom_poll"; + header.timestamp = 7574118L; + header.version = "0.0.1"; + + StartCustomPollRequestMessagePayload payload = new StartCustomPollRequestMessagePayload(); + payload.pollType = "custom"; + payload.pollId = "bar"; + payload.requesterId = "me"; + + ArrayList answers = new ArrayList(); + answers.add("Red"); + answers.add("Green"); + answers.add("Blue"); + + payload.answers = answers; + + msg.header = header; + msg.payload = payload; + + Gson gson = new Gson(); + String json = gson.toJson(msg); + System.out.println(json); + + StartCustomPollRequestMessage rxMsg = gson.fromJson(json, StartCustomPollRequestMessage.class); + + System.out.println(rxMsg.payload.answers.get(0)); + Assert.assertEquals(rxMsg.header.name, "start_custom_poll"); + } +} diff --git a/bigbluebutton-apps/build.gradle b/bigbluebutton-apps/build.gradle index d3d4f53729..1a7f006aeb 100755 --- a/bigbluebutton-apps/build.gradle +++ b/bigbluebutton-apps/build.gradle @@ -112,7 +112,7 @@ dependencies { compile 'com.google.code.gson:gson:1.7.1' providedCompile 'org.apache.commons:commons-lang3:3.2' - compile 'org.bigbluebutton:bbb-common-message:0.0.11' + compile 'org.bigbluebutton:bbb-common-message:0.0.12-SNAPSHOT' } test { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java index 4d9d731b80..fb6ff7622d 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/MessagePublisher.java @@ -1,7 +1,6 @@ package org.bigbluebutton.red5.pubsub; import java.util.Map; - import org.bigbluebutton.common.messages.*; import org.bigbluebutton.red5.pubsub.redis.MessageSender; @@ -19,6 +18,10 @@ public class MessagePublisher { sender.send(MessagingConstants.TO_POLLING_CHANNEL, msg.toJson()); } + public void sendPollingMessage(String json) { + sender.send(MessagingConstants.TO_POLLING_CHANNEL, json); + } + public void startPoll(String meetingId, String requesterId, String pollId, String pollType) { StartPollRequestMessage msg = new StartPollRequestMessage(meetingId, requesterId, pollId, pollType); sender.send(MessagingConstants.TO_POLLING_CHANNEL, msg.toJson()); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PollingService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PollingService.java index 4c0c05085d..6ef70f3008 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PollingService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/PollingService.java @@ -56,6 +56,13 @@ public class PollingService { red5GW.showPollResult(meetingID, userId, pollId, show); } + public void sendPollingMessage(String json) { + String meetingID = Red5.getConnectionLocal().getScope().getName(); + String userId = getBbbSession().getInternalUserID(); + + red5GW.sendPollingMessage(json); + } + public void startPoll(Map message) { String meetingID = Red5.getConnectionLocal().getScope().getName(); String userId = getBbbSession().getInternalUserID(); From 5472548118b4025e2bb73f9833c9b719392eb102 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Mon, 17 Aug 2015 22:40:31 +0000 Subject: [PATCH 2/2] - allow custom polling through chat message --- akka-bbb-apps/build.sbt | 2 +- .../core/BigBlueButtonInGW.scala | 6 +- .../org/bigbluebutton/core/MeetingActor.scala | 4 +- .../bigbluebutton/core/api/InMessages.scala | 1 + .../org/bigbluebutton/core/apps/Poll.scala | 35 +++++++++-- .../org/bigbluebutton/core/apps/PollApp.scala | 24 +++++++- akka-bbb-fsesl/build.sbt | 2 +- bbb-common-message/build.sbt | 8 +-- .../StartCustomPollRequestMessagePayload.java | 2 +- bigbluebutton-apps/build.gradle | 2 +- .../modules/chat/views/ChatBox.mxml | 58 +++++++++++++------ .../polling/events/StartCustomPollEvent.as | 38 ++++++++++++ .../modules/polling/maps/PollEventMap.mxml | 4 ++ .../polling/service/IPollDataService.as | 4 +- .../modules/polling/service/MessageSender.as | 38 +++++++++++- .../polling/service/NetworkPollDataService.as | 7 ++- .../modules/polling/service/PollingService.as | 11 +++- .../modules/polling/views/PollResultsModal.as | 15 ++++- .../present/ui/views/PresentationWindow.mxml | 30 ++++++++-- .../business/shapes/PollResultObject.as | 7 ++- 20 files changed, 248 insertions(+), 50 deletions(-) mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml create mode 100755 bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/StartCustomPollEvent.as mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/MessageSender.as mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollingService.as diff --git a/akka-bbb-apps/build.sbt b/akka-bbb-apps/build.sbt index 20f27ebce3..b1ae81fd0a 100755 --- a/akka-bbb-apps/build.sbt +++ b/akka-bbb-apps/build.sbt @@ -50,7 +50,7 @@ libraryDependencies ++= { "com.google.code.gson" % "gson" % "1.7.1", "redis.clients" % "jedis" % "2.1.0", "org.apache.commons" % "commons-lang3" % "3.2", - "org.bigbluebutton" % "bbb-common-message" % "0.0.12-SNAPSHOT" + "org.bigbluebutton" % "bbb-common-message" % "0.0.12" )} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala index 3341ef2f2e..f72b046a97 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -23,8 +23,10 @@ class BigBlueButtonInGW(val system: ActorSystem, recorderApp: RecorderApplicatio val bbbActor = system.actorOf(BigBlueButtonActor.props(system, recorderApp, messageSender, voiceEventRecorder), "bigbluebutton-actor") def handleBigBlueButtonMessage(message: IBigBlueButtonMessage) { - if (message.isInstanceOf[StartCustomPollRequestMessage]) { - + message match { + case msg: StartCustomPollRequestMessage => { + bbbActor ! new StartCustomPollRequest(msg.payload.meetingId, msg.payload.requesterId, msg.payload.pollType, msg.payload.answers) + } } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala index 2f8fc39276..c78adb0c14 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala @@ -154,8 +154,8 @@ class MeetingActor(val mProps: MeetingProperties, val outGW: OutMessageGateway) handleSetRecordingStatus(msg) case msg: GetRecordingStatus => handleGetRecordingStatus(msg) - // case msg: CreatePollRequest => - // handleCreatePollRequest(msg) + case msg: StartCustomPollRequest => + handleStartCustomPollRequest(msg) case msg: StartPollRequest => handleStartPollRequest(msg) case msg: StopPollRequest => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala index f8a80465cb..8db3cd818d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala @@ -78,6 +78,7 @@ case class PresentationConversionCompleted(meetingID: String, messageKey: String // Polling //case class CreatePollRequest(meetingID: String, requesterId: String, pollId: String, pollType: String) extends InMessage +case class StartCustomPollRequest(meetingID: String, requesterId: String, pollType: String, answers: Seq[String]) extends InMessage case class StartPollRequest(meetingID: String, requesterId: String, pollType: String) extends InMessage case class StopPollRequest(meetingID: String, requesterId: String) extends InMessage case class ShowPollResultRequest(meetingID: String, requesterId: String, pollId: String) extends InMessage diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/Poll.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/Poll.scala index dbeaff5336..599d5ee22d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/Poll.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/Poll.scala @@ -6,9 +6,9 @@ import scala.collection.mutable.ArrayBuffer object PollType { val YesNoPollType = "YN" val TrueFalsePollType = "TF" + val CustomPollType = "CUSTOM" val LetterPollType = "A-" val NumberPollType = "1-" - } object PollFactory { @@ -70,7 +70,30 @@ object PollFactory { questionOption } - private def createQuestion(qType: String): Option[Question] = { + private def buildAnswers(answers: Seq[String]): Array[Answer] = { + val ans = new Array[Answer](answers.length) + for (i <- 0 until answers.length) { + ans(i) = new Answer(i, answers(i), Some(answers(i))) + } + + ans + } + + private def processCustomPollType(qType: String, multiResponse: Boolean, answers: Option[Seq[String]]): Option[Question] = { + var questionOption: Option[Question] = None + + answers.foreach { ans => + val someAnswers = buildAnswers(ans) + val question = new Question(0, PollType.CustomPollType, multiResponse, None, someAnswers) + questionOption = Some(question) + } + + questionOption + } + + private def createQuestion(qType: String, answers: Option[Seq[String]]): Option[Question] = { + println("**** Creating quesion") + val qt = qType.toUpperCase() var questionOption: Option[Question] = None @@ -78,19 +101,21 @@ object PollFactory { questionOption = Some(processYesNoPollType(qt)) } else if (qt.matches(PollType.TrueFalsePollType)) { questionOption = Some(processTrueFalsePollType(qt)) + } else if (qt.matches(PollType.CustomPollType)) { + questionOption = processCustomPollType(qt, false, answers) } else if (qt.startsWith(PollType.LetterPollType)) { questionOption = processLetterPollType(qt, false) } else if (qt.startsWith(PollType.NumberPollType)) { - processNumberPollType(qt, false) + questionOption = processNumberPollType(qt, false) } questionOption } - def createPoll(id: String, pollType: String, numRespondents: Int): Option[Poll] = { + def createPoll(id: String, pollType: String, numRespondents: Int, answers: Option[Seq[String]]): Option[Poll] = { var poll: Option[Poll] = None - createQuestion(pollType) match { + createQuestion(pollType, answers) match { case Some(question) => { poll = Some(new Poll(id, Array(question), numRespondents, None)) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PollApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PollApp.scala index 94b0624748..97c7a5c431 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PollApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PollApp.scala @@ -135,6 +135,28 @@ trait PollApp { } } + def handleStartCustomPollRequest(msg: StartCustomPollRequest) { + log.debug("Received StartCustomPollRequest for pollType=[" + msg.pollType + "]") + + presModel.getCurrentPage() foreach { page => + val pollId = page.id + "/" + System.currentTimeMillis() + + val numRespondents = usersModel.numUsers() - 1 // subtract the presenter + PollFactory.createPoll(pollId, msg.pollType, numRespondents, Some(msg.answers)) foreach (poll => pollModel.addPoll(poll)) + + pollModel.getSimplePoll(pollId) match { + case Some(poll) => { + pollModel.startPoll(poll.id) + outGW.send(new PollStartedMessage(mProps.meetingID, mProps.recorded, msg.requesterId, pollId, poll)) + } + case None => { + val result = new RequestResult(StatusCodes.NOT_FOUND, Some(Array(ErrorCodes.RESOURCE_NOT_FOUND))) + sender ! new StartPollReplyMessage(mProps.meetingID, mProps.recorded, result, msg.requesterId, pollId) + } + } + } + } + def handleStartPollRequest(msg: StartPollRequest) { log.debug("Received StartPollRequest for pollType=[" + msg.pollType + "]") @@ -142,7 +164,7 @@ trait PollApp { val pollId = page.id + "/" + System.currentTimeMillis() val numRespondents = usersModel.numUsers() - 1 // subtract the presenter - PollFactory.createPoll(pollId, msg.pollType, numRespondents) foreach (poll => pollModel.addPoll(poll)) + PollFactory.createPoll(pollId, msg.pollType, numRespondents, None) foreach (poll => pollModel.addPoll(poll)) pollModel.getSimplePoll(pollId) match { case Some(poll) => { diff --git a/akka-bbb-fsesl/build.sbt b/akka-bbb-fsesl/build.sbt index 60de492fc1..641c4737f2 100755 --- a/akka-bbb-fsesl/build.sbt +++ b/akka-bbb-fsesl/build.sbt @@ -50,7 +50,7 @@ libraryDependencies ++= { "com.google.code.gson" % "gson" % "1.7.1", "redis.clients" % "jedis" % "2.1.0", "org.apache.commons" % "commons-lang3" % "3.2", - "org.bigbluebutton" % "bbb-common-message" % "0.0.11", + "org.bigbluebutton" % "bbb-common-message" % "0.0.12", "org.bigbluebutton" % "bbb-fsesl-client" % "0.0.2" )} diff --git a/bbb-common-message/build.sbt b/bbb-common-message/build.sbt index 0bf74d8d2b..debb98a81b 100755 --- a/bbb-common-message/build.sbt +++ b/bbb-common-message/build.sbt @@ -4,7 +4,7 @@ name := "bbb-common-message" organization := "org.bigbluebutton" -version := "0.0.12-SNAPSHOT" +version := "0.0.12" // We want to have our jar files in lib_managed dir. // This way we'll have the right path when we import @@ -48,12 +48,12 @@ autoScalaLibrary := false * publish to the local maven repo using "sbt publish" */ // Uncomment this to publish to local maven repo while commenting out the nexus repo -publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository"))) +//publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository"))) // Comment this out when publishing to local maven repo using SNAPSHOT version. // To push to sonatype "sbt publishSigned" -/* + publishTo := { val nexus = "https://oss.sonatype.org/" if (isSnapshot.value) @@ -61,7 +61,7 @@ publishTo := { else Some("releases" at nexus + "service/local/staging/deploy/maven2") } -*/ + // Enables publishing to maven repo publishMavenStyle := true diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java index 5565ffe125..db604a7ba5 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/StartCustomPollRequestMessagePayload.java @@ -7,5 +7,5 @@ public class StartCustomPollRequestMessagePayload { public ArrayList answers; public String pollId; public String requesterId; - + public String meetingId; } diff --git a/bigbluebutton-apps/build.gradle b/bigbluebutton-apps/build.gradle index 1a7f006aeb..7c417fb7c1 100755 --- a/bigbluebutton-apps/build.gradle +++ b/bigbluebutton-apps/build.gradle @@ -112,7 +112,7 @@ dependencies { compile 'com.google.code.gson:gson:1.7.1' providedCompile 'org.apache.commons:commons-lang3:3.2' - compile 'org.bigbluebutton:bbb-common-message:0.0.12-SNAPSHOT' + compile 'org.bigbluebutton:bbb-common-message:0.0.12' } test { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml old mode 100644 new mode 100755 index f332b0603b..06831f4dee --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml @@ -82,10 +82,10 @@ with BigBlueButton; if not, see . import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.events.LockControlEvent; import org.bigbluebutton.core.managers.UserManager; + import org.bigbluebutton.main.events.BBBEvent; import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.events.UserJoinedEvent; import org.bigbluebutton.main.events.UserLeftEvent; - import org.bigbluebutton.main.events.BBBEvent; import org.bigbluebutton.main.model.users.BBBUser; import org.bigbluebutton.main.model.users.Conference; import org.bigbluebutton.modules.chat.ChatConstants; @@ -99,6 +99,7 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.chat.model.ChatConversation; import org.bigbluebutton.modules.chat.model.ChatOptions; import org.bigbluebutton.modules.chat.vo.ChatMessageVO; + import org.bigbluebutton.modules.polling.events.StartCustomPollEvent; import org.bigbluebutton.util.i18n.ResourceUtil; private static const LOGGER:ILogger = getClassLogger(ChatBox); @@ -568,25 +569,44 @@ with BigBlueButton; if not, see . LOGGER.debug("------------------------------"); } + private function sendStartCustomPollEvent(answers:Array):void { + var dispatcher:Dispatcher = new Dispatcher(); + dispatchEvent(new StartCustomPollEvent("Custom", answers)); + } + private function sendPublicChatMessage(message:String):void { - var publicEvent:SendPublicChatMessageEvent = new SendPublicChatMessageEvent(SendPublicChatMessageEvent.SEND_PUBLIC_CHAT_MESSAGE_EVENT); - var cm:ChatMessageVO = new ChatMessageVO(); - cm.chatType = ChatConstants.PUBLIC_CHAT; - cm.fromUserID = UsersUtil.getMyUserID(); - cm.fromUsername = UsersUtil.getMyUsername(); - // get the color value from ColorPicker - cm.fromColor = cmpColorPicker.selectedColor.toString(); - // Get the current UTC time and the timezone for this sender. - // The receiver will have to convert this to local time. - var now:Date = new Date(); - cm.fromTime = now.valueOf(); - cm.fromTimezoneOffset = now.getTimezoneOffset(); - - //cm.message = ChatUtil.parseURLs(ChatUtil.cleanup(message)); - cm.message = ExternalInterface.call('parseURLs', (ChatUtil.cleanup(message))); - - publicEvent.chatMessage = cm; - globalDispatcher.dispatchEvent(publicEvent); + //var pollRegex:RegExp = /^@poll\s+?((?:[^,]+?\s*?,\s*?)*?[^,]+?)\s*?$/; + var pollRegex:RegExp = /^@poll\s+?(.+)\s*?$/; + var matchedArray:Array = message.match(pollRegex); + + if (pollRegex.test(message)) { + var tmpAnswers: Array = matchedArray[1].split(","); + var answers:Array = new Array(); + for (var i:int = 0; i < tmpAnswers.length; i++) { + var t:String = tmpAnswers[i] as String; + answers.push(StringUtil.trim(t)); + } + sendStartCustomPollEvent(answers); + } else { + var publicEvent:SendPublicChatMessageEvent = new SendPublicChatMessageEvent(SendPublicChatMessageEvent.SEND_PUBLIC_CHAT_MESSAGE_EVENT); + var cm:ChatMessageVO = new ChatMessageVO(); + cm.chatType = ChatConstants.PUBLIC_CHAT; + cm.fromUserID = UsersUtil.getMyUserID(); + cm.fromUsername = UsersUtil.getMyUsername(); + // get the color value from ColorPicker + cm.fromColor = cmpColorPicker.selectedColor.toString(); + // Get the current UTC time and the timezone for this sender. + // The receiver will have to convert this to local time. + var now:Date = new Date(); + cm.fromTime = now.valueOf(); + cm.fromTimezoneOffset = now.getTimezoneOffset(); + + //cm.message = ChatUtil.parseURLs(ChatUtil.cleanup(message)); + cm.message = ExternalInterface.call('parseURLs', (ChatUtil.cleanup(message))); + + publicEvent.chatMessage = cm; + globalDispatcher.dispatchEvent(publicEvent); + } } private function sendPrivateChatMessage(message:String):void { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/StartCustomPollEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/StartCustomPollEvent.as new file mode 100755 index 0000000000..43fd3f99af --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/StartCustomPollEvent.as @@ -0,0 +1,38 @@ +/** +* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ +* +* Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below). +* +* This program is free software; you can redistribute it and/or modify it under the +* terms of the GNU Lesser General Public License as published by the Free Software +* Foundation; either version 2.1 of the License, or (at your option) any later +* version. +* +* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY +* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License along +* with BigBlueButton; if not, see . +* +*/ +package org.bigbluebutton.modules.polling.events +{ + import flash.events.Event; + + public class StartCustomPollEvent extends Event + { + public static const START:String = "start custom poll"; + + public var pollType: String; + public var answers: Array; + + public function StartCustomPollEvent(pollType: String, answers: Array) + { + super(START, true, false); + this.pollType = pollType; + this.answers = answers; + } + + } +} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollEventMap.mxml index 2cb8a45956..b8a56c6a3f 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollEventMap.mxml @@ -38,6 +38,10 @@ + + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/IPollDataService.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/IPollDataService.as index 2b45d8e0df..e3b163703a 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/IPollDataService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/IPollDataService.as @@ -3,7 +3,9 @@ package org.bigbluebutton.modules.polling.service public interface IPollDataService { - + + function startCustomPoll(pollId: String, pollType: String, answers:Array):void; + function startPoll(pollId:String, pollType: String):void; function stopPoll(pollID:String):void; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/MessageSender.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/MessageSender.as old mode 100644 new mode 100755 index e60a632f5d..5f06fbc396 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/MessageSender.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/MessageSender.as @@ -22,11 +22,47 @@ package org.bigbluebutton.modules.polling.service import org.as3commons.logging.api.getClassLogger; import org.as3commons.logging.util.jsonXify; import org.bigbluebutton.core.BBB; - import org.bigbluebutton.core.managers.ConnectionManager; + import org.bigbluebutton.core.UsersUtil; + import org.bigbluebutton.core.managers.ConnectionManager; public class MessageSender { private static const LOGGER:ILogger = getClassLogger(MessageSender); + + public function startCustomPoll(pollId:String, pollType: String, answers:Array):void + { + + + var header:Object = new Object(); + header["timestamp"] = (new Date()).time; + header["name"] = "start_custom_poll_request_message"; + header["version"] = "0.0.1"; + + var payload:Object = new Object(); + payload["pollType"] = pollType; + payload["answers"] = answers; + payload["meetingId"] = UsersUtil.getInternalMeetingID(); + payload["pollId"] = pollId; + payload["requesterId"] = UsersUtil.getMyUserID(); + + var map:Object = new Object(); + map["header"] = header; + map["payload"] = payload; + + LOGGER.debug("startCustomPoll [{0}]", [jsonXify(map)]); + + var _nc:ConnectionManager = BBB.initConnectionManager(); + _nc.sendMessage("poll.sendPollingMessage", + function(result:String):void { + LOGGER.debug(result); + }, + function(status:String):void { + LOGGER.error(status); + }, + JSON.stringify(map) + ); + } + public function startPoll(pollId:String, pollType: String):void { var map:Object = new Object(); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/NetworkPollDataService.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/NetworkPollDataService.as index 36bf78930c..07273dc2a7 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/NetworkPollDataService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/NetworkPollDataService.as @@ -12,7 +12,12 @@ package org.bigbluebutton.modules.polling.service public function NetworkPollDataService(sender: MessageSender) { this.sender = sender; } - + + public function startCustomPoll(pollId:String, pollType: String, answers: Array):void + { + sender.startCustomPoll(pollId, pollType, answers); + } + public function startPoll(pollId:String, pollType: String):void { sender.startPoll(pollId, pollType); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollingService.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollingService.as old mode 100644 new mode 100755 index 76d9d9e518..fb38d70d6b --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollingService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollingService.as @@ -21,13 +21,14 @@ package org.bigbluebutton.modules.polling.service import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; import org.bigbluebutton.modules.polling.events.ShowPollResultEvent; + import org.bigbluebutton.modules.polling.events.StartCustomPollEvent; import org.bigbluebutton.modules.polling.events.StartPollEvent; import org.bigbluebutton.modules.polling.events.StopPollEvent; import org.bigbluebutton.modules.polling.events.VotePollEvent; import org.bigbluebutton.modules.polling.model.PollingModel; import org.bigbluebutton.modules.polling.model.SimplePoll; import org.bigbluebutton.modules.present.model.Presentation; - import org.bigbluebutton.modules.present.model.PresentationModel; + import org.bigbluebutton.modules.present.model.PresentationModel; public class PollingService { @@ -62,7 +63,13 @@ package org.bigbluebutton.modules.polling.service return null; } - + + public function handleStartCustomPollEvent(event:StartCustomPollEvent):void { + var pollId:String = generatePollId(); + if (pollId == null) return; + dataService.startCustomPoll(pollId, event.pollType, event.answers); + } + public function handleStartPollEvent(event:StartPollEvent):void { var pollId:String = generatePollId(); if (pollId == null) return; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as index be9cfc0833..283dc305c9 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as @@ -96,7 +96,12 @@ package org.bigbluebutton.modules.polling.views var answers:Array = poll.answers; for (var j:int = 0; j < answers.length; j++) { var a:SimpleAnswer = answers[j] as SimpleAnswer; - resultData.push({a:ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key), v:0}); + var localizedKey: String = ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key); + + if (localizedKey == null || localizedKey == "" || localizedKey == "undefined") { + localizedKey = a.key + } + resultData.push({a:localizedKey, v:0}); } _pollGraphic.data = resultData; @@ -111,7 +116,13 @@ package org.bigbluebutton.modules.polling.views var answers:Array = e.result.answers; for (var j:int = 0; j < answers.length; j++) { var a:SimpleAnswerResult = answers[j] as SimpleAnswerResult; - resultData.push({a:ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key), v:a.numVotes}); + var localizedKey: String = ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key); + + if (localizedKey == null || localizedKey == "" || localizedKey == "undefined") { + localizedKey = a.key; + } + + resultData.push({a:localizedKey, v:a.numVotes}); } _pollGraphic.data = resultData; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml index e703f93aff..5f2af177cb 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml @@ -69,12 +69,12 @@ with BigBlueButton; if not, see . . import org.bigbluebutton.modules.polling.events.PollShowResultEvent; import org.bigbluebutton.modules.polling.events.PollStartedEvent; import org.bigbluebutton.modules.polling.events.PollStoppedEvent; + import org.bigbluebutton.modules.polling.events.StartCustomPollEvent; import org.bigbluebutton.modules.polling.events.StartPollEvent; import org.bigbluebutton.modules.polling.events.VotePollEvent; import org.bigbluebutton.modules.polling.views.PollResultsModal; @@ -621,6 +622,7 @@ with BigBlueButton; if not, see . constructedLabel += "/" + ResourceUtil.getInstance().getString("bbb.polling.answer."+String.fromCharCode(65+i)); pollMenuData.push({label: constructedLabel}); } + pollMenuData.push({label: "Custom"}); } private function onPollStartButtonClicked():void { @@ -647,6 +649,15 @@ with BigBlueButton; if not, see . } + private function sendStartCustomPollEvent(pollType:String):void { + // Let's reset the page to display full size so we can display the result + // on the bottom right-corner. + onResetZoom(); + var dispatcher:Dispatcher = new Dispatcher(); + var answers:Array = new Array("Red", "Green", "Blue"); + dispatchEvent(new StartCustomPollEvent(pollType, answers)); + } + private function sendStartPollEvent(pollType:String):void { // Let's reset the page to display full size so we can display the result // on the bottom right-corner. @@ -658,7 +669,6 @@ with BigBlueButton; if not, see . private function menuClickHandler(e:MenuEvent):void { if(pollMenuData[e.index] != undefined) { // start the requested poll - var pollEvent:StartPollEvent = null; switch (e.index) { case 0: sendStartPollEvent("YN"); @@ -682,7 +692,11 @@ with BigBlueButton; if not, see . sendStartPollEvent("A-6"); break; case 7: - sendStartPollEvent("A-7"); + sendStartCustomPollEvent("Custom"); + //sendStartPollEvent("A-7"); + break; + case 8: + sendStartCustomPollEvent("Custom"); break; } @@ -713,7 +727,13 @@ with BigBlueButton; if not, see . var numBtns:int = e.poll.answers.length; for (var i:int=0; i