From 56da45f0716feaf5241d2c2a9919bf09dba10ad5 Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Wed, 28 Jun 2017 15:05:50 -0400 Subject: [PATCH 01/28] handle adding presentation, slide 2.0 --- .../imports/api/2.0/presentations/index.js | 1 + .../2.0/presentations/server/eventHandlers.js | 8 ++ .../server/handlers/presentationChange.js | 44 +++++++ .../server/handlers/presentationInfoReply.js | 34 ++++++ .../server/handlers/presentationRemove.js | 14 +++ .../api/2.0/presentations/server/index.js | 3 + .../api/2.0/presentations/server/methods.js | 4 + .../server/modifiers/addPresentation.js | 54 +++++++++ .../modifiers/changeCurrentPresentation.js | 53 +++++++++ .../server/modifiers/clearPresentations.js | 10 ++ .../server/modifiers/removePresentation.js | 28 +++++ .../2.0/presentations/server/publishers.js | 25 ++++ .../imports/api/2.0/slides/index.js | 1 + .../api/2.0/slides/server/eventHandlers.js | 6 + .../2.0/slides/server/handlers/slideChange.js | 16 +++ .../2.0/slides/server/handlers/slideResize.js | 17 +++ .../imports/api/2.0/slides/server/index.js | 3 + .../imports/api/2.0/slides/server/methods.js | 8 ++ .../2.0/slides/server/methods/switchSlide.js | 47 ++++++++ .../2.0/slides/server/modifiers/addSlide.js | 108 ++++++++++++++++++ .../server/modifiers/changeCurrentSlide.js | 56 +++++++++ .../slides/server/modifiers/clearSlides.js | 10 ++ .../modifiers/clearSlidesPresentation.js | 30 +++++ .../slides/server/modifiers/resizeSlide.js | 37 ++++++ .../api/2.0/slides/server/publishers.js | 24 ++++ .../imports/startup/server/redis2x.js | 2 +- 26 files changed, 642 insertions(+), 1 deletion(-) create mode 100755 bigbluebutton-html5/imports/api/2.0/presentations/index.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationChange.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/index.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/methods.js create mode 100755 bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/changeCurrentPresentation.js create mode 100755 bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/clearPresentations.js create mode 100644 bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/removePresentation.js create mode 100755 bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js create mode 100755 bigbluebutton-html5/imports/api/2.0/slides/index.js create mode 100644 bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js create mode 100644 bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js create mode 100644 bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js create mode 100644 bigbluebutton-html5/imports/api/2.0/slides/server/index.js create mode 100644 bigbluebutton-html5/imports/api/2.0/slides/server/methods.js create mode 100755 bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js create mode 100755 bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js create mode 100755 bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/changeCurrentSlide.js create mode 100755 bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlides.js create mode 100644 bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlidesPresentation.js create mode 100755 bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/resizeSlide.js create mode 100644 bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/index.js b/bigbluebutton-html5/imports/api/2.0/presentations/index.js new file mode 100755 index 0000000000..b666ce79e7 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/index.js @@ -0,0 +1 @@ +export default new Mongo.Collection('presentations2x'); diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js new file mode 100644 index 0000000000..f536528588 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js @@ -0,0 +1,8 @@ +import RedisPubSub from '/imports/startup/server/redis'; +import handlePresentationRemove from './handlers/presentationRemove'; +import handlePresentationChange from './handlers/presentationChange'; +import handlePresentationInfoReply from './handlers/presentationInfoReply'; + +// RedisPubSub.on('presentation_removed_message', handlePresentationRemove); +RedisPubSub.on('NewPresentationEvtMsg', handlePresentationChange); +// RedisPubSub.on('get_presentation_info_reply', handlePresentationInfoReply); diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationChange.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationChange.js new file mode 100644 index 0000000000..d9f6daca59 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationChange.js @@ -0,0 +1,44 @@ +import { check } from 'meteor/check'; +import Logger from '/imports/startup/server/logger'; +import Presentations from '/imports/api/2.0/presentations'; + +import addPresentation from '../modifiers/addPresentation'; + +const clearCurrentPresentation = (meetingId, presentationId) => { + const selector = { + meetingId, + presentationId: { $ne: presentationId }, + 'presentation.current': true, + }; + + const modifier = { + $set: { 'presentation.current': false }, + }; + + const cb = (err, numChanged) => { + if (err) { + return Logger.error(`Unsetting the current presentation: ${err}`); + } + + if (numChanged) { + return Logger.info('Unset as current presentation'); + } + }; + + return Presentations.update(selector, modifier, cb); +}; + +export default function handlePresentationChange({ header, body }) { + const { meetingId } = header; + const { presentation } = body; + + check(meetingId, String); + check(presentation, Object); + + // We need to clear the flag of the older current presentation ¯\_(ツ)_/¯ + if (presentation.current) { + clearCurrentPresentation(meetingId, presentation.id); + } + + return addPresentation(meetingId, presentation); +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js new file mode 100644 index 0000000000..875cfcff08 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js @@ -0,0 +1,34 @@ +import Logger from '/imports/startup/server/logger'; +import { check } from 'meteor/check'; +import { inReplyToHTML5Client } from '/imports/api/common/server/helpers'; +import Presentations from '/imports/api/2.0/presentations'; + +import addPresentation from '../modifiers/addPresentation'; +import removePresentation from '../modifiers/removePresentation'; + +export default function handlePresentationInfoReply({ payload }) { + if (!inReplyToHTML5Client({ payload })) { + return; + } + + const meetingId = payload.meeting_id; + const presentations = payload.presentations; + + check(meetingId, String); + check(presentations, Array); + + const presentationsIds = presentations.map(_ => _.id); + const presentationsToRemove = Presentations.find({ + meetingId, + 'presentation.id': { $nin: presentationsIds }, + }).fetch(); + + presentationsToRemove.forEach(p => removePresentation(meetingId, p.presentation.id)); + + const presentationsAdded = []; + presentations.forEach((presentation) => { + presentationsAdded.push(addPresentation(meetingId, presentation)); + }); + + return presentationsAdded; +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js new file mode 100644 index 0000000000..f9d7a12af6 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js @@ -0,0 +1,14 @@ +import Logger from '/imports/startup/server/logger'; +import { check } from 'meteor/check'; + +import removePresentation from '../modifiers/removePresentation'; + +export default function handlePresentationRemove({ payload }) { + const meetingId = payload.meeting_id; + const presentationId = payload.presentation_id; + + check(meetingId, String); + check(presentationId, String); + + return removePresentation(meetingId, presentationId); +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/index.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/index.js new file mode 100644 index 0000000000..92451ac76b --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/index.js @@ -0,0 +1,3 @@ +import './eventHandlers'; +import './methods'; +import './publishers'; diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/methods.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/methods.js new file mode 100644 index 0000000000..1ce65c3698 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/methods.js @@ -0,0 +1,4 @@ +import { Meteor } from 'meteor/meteor'; + +Meteor.methods({ +}); diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js new file mode 100755 index 0000000000..e2fc341067 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js @@ -0,0 +1,54 @@ +import { check } from 'meteor/check'; +import Presentations from '/imports/api/2.0/presentations'; +import Logger from '/imports/startup/server/logger'; + +import addSlide from '/imports/api/2.0/slides/server/modifiers/addSlide'; + +const addSlides = (meetingId, presentationId, slides) => { + const slidesAdded = []; + + slides.forEach((slide) => { + slidesAdded.push(addSlide(meetingId, presentationId, slide)); + }); + + return slidesAdded; +}; + +export default function addPresentation(meetingId, presentation) { + check(meetingId, String); + check(presentation, Object); + + const selector = { + meetingId, + 'presentation.id': presentation.id, + }; + + const modifier = { + $set: { + meetingId, + 'presentation.id': presentation.id, + 'presentation.name': presentation.name, + 'presentation.current': presentation.current, + 'presentation.downloadable': presentation.downloadable, + }, + }; + + const cb = (err, numChanged) => { + if (err) { + return Logger.error(`Adding presentation to collection: ${err}`); + } + + addSlides(meetingId, presentation.id, presentation.pages); + + const { insertedId } = numChanged; + if (insertedId) { + return Logger.info(`Added presentation id=${presentation.id} meeting=${meetingId}`); + } + + if (numChanged) { + return Logger.info(`Upserted presentation id=${presentation.id} meeting=${meetingId}`); + } + }; + + return Presentations.upsert(selector, modifier, cb); +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/changeCurrentPresentation.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/changeCurrentPresentation.js new file mode 100644 index 0000000000..faf9d6286a --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/changeCurrentPresentation.js @@ -0,0 +1,53 @@ +import { check } from 'meteor/check'; +import Presentations from '/imports/api/2.0/presentations'; +import Logger from '/imports/startup/server/logger'; + +export default function changeCurrentPresentation(meetingId, presentationId) { + check(meetingId, String); + check(presentationId, String); + + const oldCurrent = { + selector: { + meetingId, + 'presentation.current': true, + }, + modifier: { + $set: { 'presentation.current': false }, + }, + callback: (err) => { + if (err) { + return Logger.error(`Unsetting the current presentation: ${err}`); + } + + return Logger.info('Unsetted as current presentation'); + }, + }; + + const newCurrent = { + selector: { + meetingId, + 'presentation.id': presentationId, + }, + modifier: { + $set: { 'presentation.current': true }, + }, + callback: (err) => { + if (err) { + return Logger.error(`Setting as current presentation id=${presentationId}: ${err}`); + } + + return Logger.info(`Setted as current presentation id=${presentationId}`); + }, + }; + + const oldPresentation = Presentations.findOne(oldCurrent.selector); + const newPresentation = Presentations.findOne(newCurrent.selector); + + if (newPresentation) { + Presentations.update(newPresentation._id, newCurrent.modifier, newCurrent.callback); + } + + if (oldPresentation) { + Presentations.update(oldPresentation._id, oldCurrent.modifier, oldCurrent.callback); + } +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/clearPresentations.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/clearPresentations.js new file mode 100755 index 0000000000..2b98fcf76f --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/clearPresentations.js @@ -0,0 +1,10 @@ +import Presentations from '/imports/api/2.0/presentations'; +import Logger from '/imports/startup/server/logger'; + +export default function clearPresentations(meetingId) { + if (meetingId) { + return Presentations.remove({ meetingId }, + Logger.info(`Cleared Presentations (${meetingId})`)); + } + return Presentations.remove({}, Logger.info('Cleared Presentations (all)')); +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/removePresentation.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/removePresentation.js new file mode 100644 index 0000000000..9b4a141589 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/removePresentation.js @@ -0,0 +1,28 @@ +import { check } from 'meteor/check'; +import Presentations from '/imports/api/2.0/presentations'; +import Logger from '/imports/startup/server/logger'; + +import clearSlidesPresentation from '/imports/api/2.0/slides/server/modifiers/clearSlidesPresentation'; + +export default function removePresentation(meetingId, presentationId) { + check(meetingId, String); + check(presentationId, String); + + const selector = { + meetingId, + 'presentation.id': presentationId, + }; + + const cb = (err, numChanged) => { + if (err) { + return Logger.error(`Removing presentation from collection: ${err}`); + } + + if (numChanged) { + clearSlidesPresentation(meetingId, presentationId); + return Logger.info(`Removed presentation id=${presentationId} meeting=${meetingId}`); + } + }; + + return Presentations.remove(selector, cb); +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js new file mode 100755 index 0000000000..254f368cb7 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js @@ -0,0 +1,25 @@ +import { Meteor } from 'meteor/meteor'; +import { check } from 'meteor/check'; +import Presentations from '/imports/api/2.0/presentations'; +import Logger from '/imports/startup/server/logger'; +import mapToAcl from '/imports/startup/mapToAcl'; + +function presentations(credentials) { + const { meetingId, requesterUserId, requesterToken } = credentials; + + check(meetingId, String); + check(requesterUserId, String); + check(requesterToken, String); + + Logger.info(`Publishing Presentations for ${meetingId} ${requesterUserId} ${requesterToken}`); + + return Presentations.find({ meetingId }); +} + +function publish(...args) { + const boundPresentations = presentations.bind(this); + return mapToAcl('subscriptions.presentations', boundPresentations)(args); +} + +Meteor.publish('presentations', publish); + diff --git a/bigbluebutton-html5/imports/api/2.0/slides/index.js b/bigbluebutton-html5/imports/api/2.0/slides/index.js new file mode 100755 index 0000000000..8a7953cfc4 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/index.js @@ -0,0 +1 @@ +export default new Mongo.Collection('slides2x'); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js new file mode 100644 index 0000000000..1a9980b4c4 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js @@ -0,0 +1,6 @@ +import RedisPubSub from '/imports/startup/server/redis'; +import handleSlideResize from './handlers/slideResize'; +import handleSlideChange from './handlers/slideChange'; + +// RedisPubSub.on('presentation_page_resized_message', handleSlideResize); +// RedisPubSub.on('presentation_page_changed_message', handleSlideChange); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js new file mode 100644 index 0000000000..334aa9bfb9 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js @@ -0,0 +1,16 @@ +import Logger from '/imports/startup/server/logger'; +import { check } from 'meteor/check'; +import changeCurrentSlide from '../modifiers/changeCurrentSlide'; + +export default function handleSlideChange({ payload }) { + const meetingId = payload.meeting_id; + const slide = payload.page; + + check(meetingId, String); + check(slide, Object); + + const slideId = slide.id; + const presentationId = slideId.split('/')[0]; + + return changeCurrentSlide(meetingId, presentationId, slideId); +} diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js new file mode 100644 index 0000000000..1d7ff44d48 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js @@ -0,0 +1,17 @@ +import Logger from '/imports/startup/server/logger'; +import Slides from '/imports/api/2.0/slides'; +import { check } from 'meteor/check'; +import resizeSlide from '../modifiers/resizeSlide'; + +export default function handleSlideResize({ payload }) { + const meetingId = payload.meeting_id; + const slide = payload.page; + + check(meetingId, String); + check(slide, Object); + + const slideId = slide.id; + const presentationId = slideId.split('/')[0]; + + return resizeSlide(meetingId, presentationId, slideId, slide); +} diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/index.js b/bigbluebutton-html5/imports/api/2.0/slides/server/index.js new file mode 100644 index 0000000000..92451ac76b --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/index.js @@ -0,0 +1,3 @@ +import './eventHandlers'; +import './methods'; +import './publishers'; diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/methods.js b/bigbluebutton-html5/imports/api/2.0/slides/server/methods.js new file mode 100644 index 0000000000..058a832332 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/methods.js @@ -0,0 +1,8 @@ +import { Meteor } from 'meteor/meteor'; +import mapToAcl from '/imports/startup/mapToAcl'; +import switchSlide from './methods/switchSlide'; + +Meteor.methods(mapToAcl(['methods.switchSlide', 'methods.switchSlideMessage'], { + switchSlide, + switchSlideMessage: switchSlide, // legacy +})); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js b/bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js new file mode 100755 index 0000000000..22c537602b --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js @@ -0,0 +1,47 @@ +import Presentations from '/imports/api/2.0/presentations'; +import Slides from '/imports/api/2.0/slides'; +import { Meteor } from 'meteor/meteor'; +import { check } from 'meteor/check'; +import RedisPubSub from '/imports/startup/server/redis'; + +export default function switchSlide(credentials, slideNumber) { + const REDIS_CONFIG = Meteor.settings.redis; + + const CHANNEL = REDIS_CONFIG.channels.toBBBApps.presentation; + const EVENT_NAME = 'go_to_slide'; + + const { meetingId, requesterUserId, requesterToken } = credentials; + + check(meetingId, String); + check(requesterUserId, String); + check(requesterToken, String); + check(slideNumber, Number); + + const Presentation = Presentations.findOne({ + meetingId, + 'presentation.current': true, + }); + + if (!Presentation) { + throw new Meteor.Error( + 'presentation-not-found', 'You need a presentation to be able to switch slides'); + } + + const Slide = Slides.findOne({ + meetingId, + presentationId: Presentation.presentation.id, + 'slide.num': parseInt(slideNumber, 2), + }); + + if (!Slide) { + throw new Meteor.Error( + 'slide-not-found', `Slide number ${slideNumber} not found in the current presentation`); + } + + const payload = { + page: Slide.slide.id, + meeting_id: meetingId, + }; + + return RedisPubSub.publish(CHANNEL, EVENT_NAME, payload); +} diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js new file mode 100755 index 0000000000..bbd01e6e05 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js @@ -0,0 +1,108 @@ +import probe from 'probe-image-size'; +import { Meteor } from 'meteor/meteor'; +import { check } from 'meteor/check'; +import RedisPubSub from '/imports/startup/server/redis'; +import Slides from '/imports/api/2.0/slides'; +import Logger from '/imports/startup/server/logger'; +import { SVG, PNG } from '/imports/utils/mimeTypes'; + +const requestWhiteboardHistory = (meetingId, slideId) => { + const REDIS_CONFIG = Meteor.settings.redis; + const CHANNEL = REDIS_CONFIG.channels.toBBBApps.whiteboard; + const EVENT_NAME = 'request_whiteboard_annotation_history_request'; + + const payload = { + meeting_id: meetingId, + requester_id: 'nodeJSapp', + whiteboard_id: slideId, + reply_to: `${meetingId}/nodeJSapp`, + }; + + return RedisPubSub.publish(CHANNEL, EVENT_NAME, payload); +}; + +const SUPPORTED_TYPES = [SVG, PNG]; + +export default function addSlide(meetingId, presentationId, slide) { + check(meetingId, String); + check(presentationId, String); + check(slide, Object); + + const selector = { + meetingId, + presentationId, + 'slide.id': slide.id, + }; + + const imageUri = slide.svgUri || slide.pngUri; + + const modifier = { + $set: { + meetingId, + presentationId, + slide: { + id: slide.id, + num: slide.num, + thumb_uri: slide.thumbUri, + swf_uri: slide.swfUri, + txt_uri: slide.txtUri, + // svgUri or pngUri is represented by imageUri + current: slide.current, + x_offset: slide.xOffset, + y_offset: slide.yOffset, + width_ratio: slide.widthRatio, + height_ratio: slide.heightRatio, + img_uri: imageUri, + + // width and height are additionally calculated, they are not received + width: slide.width, + height: slide.height, + }, + }, + }; + + const cb = (err, numChanged) => { + if (err) { + return Logger.error(`Adding slide to collection: ${err}`); + } + + const { insertedId } = numChanged; + + requestWhiteboardHistory(meetingId, slide.id); + + if (insertedId) { + return Logger.info(`Added slide id=${slide.id} to presentation=${presentationId}`); + } + + if (numChanged) { + return Logger.info(`Upserted slide id=${slide.id} to presentation=${presentationId}`); + } + }; + + return fetchImageSizes(imageUri) + .then(({ width, height }) => { + modifier.$set.slide.width = width; + modifier.$set.slide.height = height; + + return Slides.upsert(selector, modifier, cb); + }) + .catch(reason => + Logger.error(`Error parsing image size. ${reason}. slide=${slide.id} uri=${imageUri}`)); +} + +const fetchImageSizes = imageUri => + probe(imageUri) + .then((result) => { + if (!SUPPORTED_TYPES.includes(result.mime)) { + throw `Invalid image type, received ${result.mime} expecting ${SUPPORTED_TYPES.join()}`; + } + + return { + width: result.width, + height: result.height, + }; + }) + .catch((reason) => { + Logger.error(`Error parsing image size. ${reason}. uri=${imageUri}`); + return reason; + }); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/changeCurrentSlide.js b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/changeCurrentSlide.js new file mode 100755 index 0000000000..74c691226b --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/changeCurrentSlide.js @@ -0,0 +1,56 @@ +import { check } from 'meteor/check'; +import Slides from '/imports/api/2.0/slides'; +import Logger from '/imports/startup/server/logger'; + +export default function changeCurrentSlide(meetingId, presentationId, slideId) { + check(meetingId, String); + check(presentationId, String); + check(slideId, String); + + const oldCurrent = { + selector: { + meetingId, + presentationId, + 'slide.current': true, + }, + modifier: { + $set: { 'slide.current': false }, + }, + callback: (err) => { + if (err) { + return Logger.error(`Unsetting the current slide: ${err}`); + } + + return Logger.info('Unsetted the current slide'); + }, + }; + + const newCurrent = { + selector: { + meetingId, + presentationId, + 'slide.id': slideId, + }, + modifier: { + $set: { 'slide.current': true }, + }, + callback: (err) => { + if (err) { + return Logger.error(`Setting as current slide id=${slideId}: ${err}`); + } + + return Logger.info(`Setted as current slide id=${slideId}`); + }, + }; + + const oldSlide = Slides.findOne(oldCurrent.selector); + const newSlide = Slides.findOne(newCurrent.selector); + + if (newSlide) { + Slides.update(newSlide._id, newCurrent.modifier, newCurrent.callback); + } + + if (oldSlide) { + Slides.update(oldSlide._id, oldCurrent.modifier, oldCurrent.callback); + } +} diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlides.js b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlides.js new file mode 100755 index 0000000000..a8aa8096eb --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlides.js @@ -0,0 +1,10 @@ +import Slides from '/imports/api/2.0/slides'; +import Logger from '/imports/startup/server/logger'; + +export default function clearSlides(meetingId) { + if (meetingId) { + return Slides.remove({ meetingId }, Logger.info(`Cleared Slides (${meetingId})`)); + } + + return Slides.remove({}, Logger.info('Cleared Slides (all)')); +} diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlidesPresentation.js b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlidesPresentation.js new file mode 100644 index 0000000000..3331b11cda --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/clearSlidesPresentation.js @@ -0,0 +1,30 @@ +import Slides from '/imports/api/2.0/slides'; +import Logger from '/imports/startup/server/logger'; +import { check } from 'meteor/check'; +import clearShapesWhiteboard from '/imports/api/2.0/shapes/server/modifiers/clearShapesWhiteboard'; + +export default function clearSlidesPresentation(meetingId, presentationId) { + check(meetingId, String); + check(presentationId, String); + + const selector = { + meetingId, + presentationId, + }; + + const whiteboardIds = Slides.find(selector).map(row => row.slide.id); + + const cb = (err, numChanged) => { + if (err) { + return Logger.error(`Removing Slides from collection: ${err}`); + } + + if (numChanged) { + whiteboardIds.forEach(whiteboardId => clearShapesWhiteboard(meetingId, whiteboardId)); + + return Logger.info(`Removed Slides where presentationId=${presentationId}`); + } + }; + + return Slides.remove(selector, cb); +} diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/resizeSlide.js b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/resizeSlide.js new file mode 100755 index 0000000000..cb3285d188 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/resizeSlide.js @@ -0,0 +1,37 @@ +import { check } from 'meteor/check'; +import Slides from '/imports/api/2.0/slides'; +import Logger from '/imports/startup/server/logger'; + +export default function resizeSlide(meetingId, presentationId, slideId, slide) { + check(meetingId, String); + check(presentationId, String); + check(slideId, String); + check(slide, Object); + + const selector = { + meetingId, + presentationId, + 'slide.id': slideId, + }; + + const modifier = { + $set: { + 'slide.width_ratio': slide.width_ratio, + 'slide.height_ratio': slide.height_ratio, + 'slide.x_offset': slide.x_offset, + 'slide.y_offset': slide.y_offset, + }, + }; + + const cb = (err, numChanged) => { + if (err) { + return Logger.error(`Resizing slide id=${slideId}: ${err}`); + } + + if (numChanged) { + return Logger.info(`Resized slide id=${slideId}`); + } + }; + + return Slides.update(selector, modifier, cb); +} diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js b/bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js new file mode 100644 index 0000000000..581a539ab1 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js @@ -0,0 +1,24 @@ +import Slides from '/imports/api/2.0/slides'; +import { Meteor } from 'meteor/meteor'; +import { check } from 'meteor/check'; +import Logger from '/imports/startup/server/logger'; +import mapToAcl from '/imports/startup/mapToAcl'; + +function slides(credentials) { + const { meetingId, requesterUserId, requesterToken } = credentials; + + check(meetingId, String); + check(requesterUserId, String); + check(requesterToken, String); + + Logger.info(`Publishing Slides for ${meetingId} ${requesterUserId} ${requesterToken}`); + + return Slides.find({ meetingId }); +} + +function publish(...args) { + const boundSlides = slides.bind(this); + return mapToAcl('subscriptions.slides', boundSlides)(args); +} + +Meteor.publish('slides', publish); diff --git a/bigbluebutton-html5/imports/startup/server/redis2x.js b/bigbluebutton-html5/imports/startup/server/redis2x.js index 5f61903ebb..68bfa6f02c 100644 --- a/bigbluebutton-html5/imports/startup/server/redis2x.js +++ b/bigbluebutton-html5/imports/startup/server/redis2x.js @@ -75,7 +75,7 @@ class RedisPubSub2x { } handleMessage(pattern, channel, message) { - console.error(`2.0 handleMessage: ${message}`); + Logger.error(`2.0 handleMessage: ${message}`); const parsedMessage = JSON.parse(message); const { header } = parsedMessage.core; const eventName = header.name; From 7e798b96ddfe77de40e9107cd687a6a0fd57d851 Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Wed, 28 Jun 2017 15:24:19 -0400 Subject: [PATCH 02/28] clearing some linting issues --- .../2.0/presentations/server/eventHandlers.js | 4 +-- .../server/handlers/presentationInfoReply.js | 1 - .../server/handlers/presentationRemove.js | 1 - .../api/2.0/slides/server/eventHandlers.js | 6 ++-- .../2.0/slides/server/handlers/slideChange.js | 1 - .../2.0/slides/server/handlers/slideResize.js | 2 -- .../2.0/slides/server/modifiers/addSlide.js | 34 +++++++++---------- .../imports/startup/server/redis2x.js | 3 +- 8 files changed, 24 insertions(+), 28 deletions(-) diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js index f536528588..157ac05ade 100644 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js @@ -1,7 +1,7 @@ import RedisPubSub from '/imports/startup/server/redis'; -import handlePresentationRemove from './handlers/presentationRemove'; +// import handlePresentationRemove from './handlers/presentationRemove'; import handlePresentationChange from './handlers/presentationChange'; -import handlePresentationInfoReply from './handlers/presentationInfoReply'; +// import handlePresentationInfoReply from './handlers/presentationInfoReply'; // RedisPubSub.on('presentation_removed_message', handlePresentationRemove); RedisPubSub.on('NewPresentationEvtMsg', handlePresentationChange); diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js index 875cfcff08..1efd4469ed 100644 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js @@ -1,4 +1,3 @@ -import Logger from '/imports/startup/server/logger'; import { check } from 'meteor/check'; import { inReplyToHTML5Client } from '/imports/api/common/server/helpers'; import Presentations from '/imports/api/2.0/presentations'; diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js index f9d7a12af6..3832d22254 100644 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationRemove.js @@ -1,4 +1,3 @@ -import Logger from '/imports/startup/server/logger'; import { check } from 'meteor/check'; import removePresentation from '../modifiers/removePresentation'; diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js index 1a9980b4c4..74f5d0c653 100644 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js @@ -1,6 +1,6 @@ -import RedisPubSub from '/imports/startup/server/redis'; -import handleSlideResize from './handlers/slideResize'; -import handleSlideChange from './handlers/slideChange'; +// import RedisPubSub from '/imports/startup/server/redis'; +// import handleSlideResize from './handlers/slideResize'; +// import handleSlideChange from './handlers/slideChange'; // RedisPubSub.on('presentation_page_resized_message', handleSlideResize); // RedisPubSub.on('presentation_page_changed_message', handleSlideChange); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js index 334aa9bfb9..288aa46763 100644 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js @@ -1,4 +1,3 @@ -import Logger from '/imports/startup/server/logger'; import { check } from 'meteor/check'; import changeCurrentSlide from '../modifiers/changeCurrentSlide'; diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js index 1d7ff44d48..05589e8df0 100644 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideResize.js @@ -1,5 +1,3 @@ -import Logger from '/imports/startup/server/logger'; -import Slides from '/imports/api/2.0/slides'; import { check } from 'meteor/check'; import resizeSlide from '../modifiers/resizeSlide'; diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js index bbd01e6e05..dab4dc618b 100755 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js @@ -23,6 +23,23 @@ const requestWhiteboardHistory = (meetingId, slideId) => { const SUPPORTED_TYPES = [SVG, PNG]; +const fetchImageSizes = imageUri => + probe(imageUri) + .then((result) => { + if (!SUPPORTED_TYPES.includes(result.mime)) { + throw `Invalid image type, received ${result.mime} expecting ${SUPPORTED_TYPES.join()}`; + } + + return { + width: result.width, + height: result.height, + }; + }) + .catch((reason) => { + Logger.error(`Error parsing image size. ${reason}. uri=${imageUri}`); + return reason; + }); + export default function addSlide(meetingId, presentationId, slide) { check(meetingId, String); check(presentationId, String); @@ -89,20 +106,3 @@ export default function addSlide(meetingId, presentationId, slide) { .catch(reason => Logger.error(`Error parsing image size. ${reason}. slide=${slide.id} uri=${imageUri}`)); } - -const fetchImageSizes = imageUri => - probe(imageUri) - .then((result) => { - if (!SUPPORTED_TYPES.includes(result.mime)) { - throw `Invalid image type, received ${result.mime} expecting ${SUPPORTED_TYPES.join()}`; - } - - return { - width: result.width, - height: result.height, - }; - }) - .catch((reason) => { - Logger.error(`Error parsing image size. ${reason}. uri=${imageUri}`); - return reason; - }); diff --git a/bigbluebutton-html5/imports/startup/server/redis2x.js b/bigbluebutton-html5/imports/startup/server/redis2x.js index 68bfa6f02c..fc5d8a1181 100644 --- a/bigbluebutton-html5/imports/startup/server/redis2x.js +++ b/bigbluebutton-html5/imports/startup/server/redis2x.js @@ -1,7 +1,8 @@ import Redis from 'redis'; -import Logger from './logger'; import { Meteor } from 'meteor/meteor'; import { EventEmitter2 } from 'eventemitter2'; +import Logger from './logger'; + class RedisPubSub2x { constructor(config = {}) { From 63522c6a9528f481f2c9d23ea3aa997100979eca Mon Sep 17 00:00:00 2001 From: Oswaldo Acauan Date: Thu, 29 Jun 2017 08:54:19 -0300 Subject: [PATCH 03/28] Use flat package on mongo upsert --- .../api/2.0/meetings/server/eventHandlers.js | 16 --------- .../meetings/server/modifiers/addMeeting.js | 34 ++++--------------- bigbluebutton-html5/package.json | 1 + 3 files changed, 8 insertions(+), 43 deletions(-) diff --git a/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js index 5249e2648e..f182e9ae65 100644 --- a/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js @@ -1,20 +1,4 @@ import RedisPubSub from '/imports/startup/server/redis2x'; -// import handleMeetingDestruction from './handlers/meetingDestruction'; -// import handleRecordingStatusChange from './handlers/recordingStatusChange'; -// import handlePermissionSettingsChange from './handlers/permissionSettingsChange'; import handleMeetingCreation from './handlers/meetingCreation'; -// import handleGetAllMeetings from './handlers/getAllMeetings'; -// import handleStunTurnReply from './handlers/stunTurnReply'; -// RedisPubSub.on('meeting_destroyed_event', handleMeetingDestruction); -// RedisPubSub.on('meeting_ended_message', handleMeetingDestruction); -// RedisPubSub.on('end_and_kick_all_message', handleMeetingDestruction); -// RedisPubSub.on('disconnect_all_users_message', handleMeetingDestruction); -// RedisPubSub.on('recording_status_changed_message', handleRecordingStatusChange); -// RedisPubSub.on('new_permission_settings', handlePermissionSettingsChange); -// RedisPubSub.on('meeting_created_message', handleMeetingCreation); -// RedisPubSub.on('get_all_meetings_reply_message', handleGetAllMeetings); -// RedisPubSub.on('send_stun_turn_info_reply_message', handleStunTurnReply); - -// 2x RedisPubSub.on('MeetingCreatedEvtMsg', handleMeetingCreation); diff --git a/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js b/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js index edecafd641..9779d814c5 100755 --- a/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js +++ b/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js @@ -1,3 +1,4 @@ +import flat from 'flat'; import { check } from 'meteor/check'; import Meetings from '/imports/api/2.0/meetings'; import Logger from '/imports/startup/server/logger'; @@ -13,48 +14,27 @@ export default function addMeeting(meeting) { 'meetingProp.intId': meetingId, }; - const { - meetingProp, - breakoutProps, - durationProps, - password, - recordProp, - welcomeProp, - voiceProp, - usersProp, - metadataProp, - screenshareProps, - } = meeting; + console.log(flat(meeting)); const modifier = { - $set: { - meetingProp, - breakoutProps, - durationProps, - password, - recordProp, - welcomeProp, - voiceProp, - usersProp, - metadataProp, - screenshareProps, - }, + $set: flat(meeting), }; const cb = (err, numChanged) => { if (err) { - return Logger.error(`Adding meeting to collection: ${err}`); + Logger.error(`Adding meeting to collection: ${err}`); + return; } initializeCursor(meetingId); const { insertedId } = numChanged; if (insertedId) { - return Logger.info(`Added meeting2x id=${meetingId}`); + Logger.info(`Added meeting2x id=${meetingId}`); } if (numChanged) { - return Logger.info(`Upserted meeting2x id=${meetingId}`); + Logger.info(`Upserted meeting2x id=${meetingId}`); } }; diff --git a/bigbluebutton-html5/package.json b/bigbluebutton-html5/package.json index d96b85444c..5caa13114c 100644 --- a/bigbluebutton-html5/package.json +++ b/bigbluebutton-html5/package.json @@ -20,6 +20,7 @@ "babel-runtime": "^6.23.0", "classnames": "^2.2.5", "eventemitter2": "^2.1.3", + "flat": "^2.0.1", "hiredis": "^0.5.0", "history": "~3.3.0", "lodash": "~4.17.4", From ace3afeb70f589ae592ec73f99affb0f68129bac Mon Sep 17 00:00:00 2001 From: Oswaldo Acauan Date: Thu, 29 Jun 2017 09:01:10 -0300 Subject: [PATCH 04/28] Remove console.log --- .../imports/api/2.0/meetings/server/modifiers/addMeeting.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js b/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js index 9779d814c5..31b6414a63 100755 --- a/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js +++ b/bigbluebutton-html5/imports/api/2.0/meetings/server/modifiers/addMeeting.js @@ -14,8 +14,6 @@ export default function addMeeting(meeting) { 'meetingProp.intId': meetingId, }; - console.log(flat(meeting)); - const modifier = { $set: flat(meeting), }; From 096b4d96a51452aa9bb0a992ba571a13f7b5b217 Mon Sep 17 00:00:00 2001 From: Oswaldo Acauan Date: Thu, 29 Jun 2017 13:11:53 -0300 Subject: [PATCH 05/28] Update package-lock.json --- bigbluebutton-html5/package-lock.json | 509 +------------------------- 1 file changed, 4 insertions(+), 505 deletions(-) diff --git a/bigbluebutton-html5/package-lock.json b/bigbluebutton-html5/package-lock.json index e52f314ece..10b58e0d68 100644 --- a/bigbluebutton-html5/package-lock.json +++ b/bigbluebutton-html5/package-lock.json @@ -50,12 +50,6 @@ "version": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" }, - "app-root-path": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.0.1.tgz", - "integrity": "sha1-zWLc+OT9WkF+/GZNLlsQZTxlG0Y=", - "dev": true - }, "aproba": { "version": "https://registry.npmjs.org/aproba/-/aproba-1.0.4.tgz", "integrity": "sha1-JxNoB3XnYUyLoYbAZdTi5S0QcsA=" @@ -99,18 +93,6 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, - "asap": { - "version": "https://registry.npmjs.org/asap/-/asap-2.0.5.tgz", - "integrity": "sha1-UidltQw1EEkOUtfc/ghe+bqWlY8=" - }, - "asn1": { - "version": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" - }, - "assert-plus": { - "version": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" - }, "ast-types-flow": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", @@ -130,14 +112,6 @@ "integrity": "sha1-l7yFTH0Ll5+NZIneVHoNF/swf20=", "dev": true }, - "autosize": { - "version": "https://registry.npmjs.org/autosize/-/autosize-3.0.21.tgz", - "integrity": "sha1-8YL0DRd1fZeKE5pMnKQMTA5EhgM=" - }, - "aws-sign2": { - "version": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" - }, "aws4": { "version": "https://registry.npmjs.org/aws4/-/aws4-1.4.1.tgz", "integrity": "sha1-/efVKSRm0jDl7g9OA42d+qsI/GE=" @@ -172,10 +146,6 @@ } } }, - "balanced-match": { - "version": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=" - }, "bindings": { "version": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=" @@ -190,14 +160,6 @@ } } }, - "block-stream": { - "version": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=" - }, - "boom": { - "version": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=" - }, "brace-expansion": { "version": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz", "integrity": "sha1-cZfX6qm4fmSDkOph/GbIRCdCDfk=" @@ -213,7 +175,8 @@ }, "builtin-modules": { "version": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true }, "caller-path": { "version": "0.1.0", @@ -278,28 +241,12 @@ "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", "dev": true }, - "cli-spinners": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-0.1.2.tgz", - "integrity": "sha1-u3ZNiOGF+54eaiofGXcjGPYF4xw=", - "dev": true - }, - "cli-truncate": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", - "integrity": "sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ=", - "dev": true - }, "cli-width": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=", "dev": true }, - "cliui": { - "version": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=" - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -314,18 +261,6 @@ "version": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=" }, - "combined-stream": { - "version": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=" - }, - "commander": { - "version": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=" - }, - "concat-map": { - "version": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, "concat-stream": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", @@ -352,10 +287,6 @@ } } }, - "console-control-strings": { - "version": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, "contains-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", @@ -366,66 +297,14 @@ "version": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" }, - "core-util-is": { - "version": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cosmiconfig": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-1.1.0.tgz", - "integrity": "sha1-DeoPmATv37kp+7GxiOJVU+oFPTc=", - "dev": true, - "dependencies": { - "argparse": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", - "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", - "dev": true - }, - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, - "js-yaml": { - "version": "3.8.4", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.8.4.tgz", - "integrity": "sha1-UgtFZPhlc7qWZir4Woyvp7S1pvY=", - "dev": true - } - } - }, "create-error-class": { "version": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=" }, - "create-react-class": { - "version": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.5.3.tgz", - "integrity": "sha1-+w98rnkznpoXnhlO9Gbvo5I4IP4=", - "dependencies": { - "js-tokens": { - "version": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", - "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=" - }, - "loose-envify": { - "version": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=" - }, - "object-assign": { - "version": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" - } - } - }, "cross-spawn": { "version": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=" }, - "cryptiles": { - "version": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=" - }, "css-selector-tokenizer": { "version": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz", "integrity": "sha1-5piEdK6MlTR3v15+/s/OzNnPTIY=", @@ -464,12 +343,6 @@ } } }, - "date-fns": { - "version": "1.28.5", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.28.5.tgz", - "integrity": "sha1-JXz8RdMi30XvVlhmWWfuhBzXP68=", - "dev": true - }, "debug": { "version": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=" @@ -500,14 +373,6 @@ "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", "dev": true }, - "delayed-stream": { - "version": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "delegates": { - "version": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, "doctrine": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", @@ -518,44 +383,21 @@ "version": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-3.2.1.tgz", "integrity": "sha1-MgPgf+0he9H0JLAZc1WC/Deyglo=" }, - "double-ended-queue": { - "version": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz", - "integrity": "sha1-ED01J/0xUo9AGIEwyEHv3XgmTlw=" - }, "duplexer3": { "version": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" }, - "ecc-jsbn": { - "version": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", - "optional": true - }, "electron-to-chromium": { "version": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.13.tgz", "integrity": "sha1-GzperObgh7teJXoQCwy/6Bsokfw=", "dev": true }, - "elegant-spinner": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", - "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", - "dev": true - }, - "element-class": { - "version": "https://registry.npmjs.org/element-class/-/element-class-0.2.2.tgz", - "integrity": "sha1-nTu9B2f5AT744cjr5yLBQCpgBQ4=" - }, "emoji-regex": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.4.2.tgz", "integrity": "sha1-owtv7jU9QG2Wz7n6dlvcgol+/24=", "dev": true }, - "encoding": { - "version": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", - "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=" - }, "error-ex": { "version": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz", "integrity": "sha1-5ntD8+gsluo6WE/+4Ln8MyXYAtk=" @@ -635,7 +477,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true }, "globals": { @@ -839,10 +681,6 @@ } } }, - "exenv": { - "version": "https://registry.npmjs.org/exenv/-/exenv-1.2.0.tgz", - "integrity": "sha1-ODXxJ6vwdb/ggtCu1EhAV8eOPIk=" - }, "exit-hook": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", @@ -853,10 +691,6 @@ "version": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", "integrity": "sha1-WkdDU7nzNT3dgXbf03uRyDpG8dQ=" }, - "extsprintf": { - "version": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", - "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=" - }, "eyes": { "version": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" @@ -910,10 +744,6 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, - "forever-agent": { - "version": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, "form-data": { "version": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz", "integrity": "sha1-BaxrwiIntD5EYfSIFhVUaZ1Pi14=" @@ -940,18 +770,6 @@ "version": "https://registry.npmjs.org/gaze/-/gaze-1.1.1.tgz", "integrity": "sha1-q4HVV9G1FfV1K9XxEX1vo8Tp20E=" }, - "generate-function": { - "version": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", - "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=" - }, - "generate-object-property": { - "version": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", - "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=" - }, - "get-caller-file": { - "version": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=" - }, "get-stdin": { "version": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=" @@ -985,7 +803,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true }, "minimatch": { @@ -1018,10 +836,6 @@ "version": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.6.tgz", "integrity": "sha1-UUw4dysxvuLgi+3CGgrrOr9UwZ4=" }, - "graceful-readlink": { - "version": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" - }, "har-validator": { "version": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=" @@ -1036,23 +850,11 @@ "version": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=" }, - "has-color": { - "version": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=" - }, "has-flag": { "version": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", "dev": true }, - "has-unicode": { - "version": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, - "hawk": { - "version": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=" - }, "hiredis": { "version": "https://registry.npmjs.org/hiredis/-/hiredis-0.5.0.tgz", "integrity": "sha1-2wOpi+zXAD0TwmAEOs7s+s31m4c=" @@ -1061,22 +863,10 @@ "version": "https://registry.npmjs.org/history/-/history-3.3.0.tgz", "integrity": "sha1-/O3M6PEpdTcVRdc1RhAzV5ptrpw=" }, - "hoek": { - "version": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" - }, - "hoist-non-react-statics": { - "version": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz", - "integrity": "sha1-qkSM8JhtVcxAdzsXF0t90GbLfPs=" - }, "hosted-git-info": { "version": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.1.5.tgz", "integrity": "sha1-C6gdkNouJas0ozLm7HeTbhWYEYs=" }, - "http-signature": { - "version": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=" - }, "husky": { "version": "0.13.4", "resolved": "https://registry.npmjs.org/husky/-/husky-0.13.4.tgz", @@ -1134,12 +924,6 @@ } } }, - "interpret": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz", - "integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A=", - "dev": true - }, "intl-format-cache": { "version": "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-2.0.5.tgz", "integrity": "sha1-tITO/Lk1PzdPJd44mjzuoa8Y18k=" @@ -1160,18 +944,6 @@ "version": "https://registry.npmjs.org/invariant/-/invariant-2.2.1.tgz", "integrity": "sha1-sJcBBUdmjH4zcCjr6Bbr42yKjVQ=" }, - "invert-kv": { - "version": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" - }, - "is-arrayish": { - "version": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" - }, - "is-builtin-module": { - "version": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=" - }, "is-callable": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", @@ -1220,16 +992,6 @@ "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", "dev": true }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-property": { - "version": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=" - }, "is-redirect": { "version": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=" @@ -1260,10 +1022,6 @@ "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", "dev": true }, - "is-typedarray": { - "version": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, "is-utf8": { "version": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" @@ -1276,10 +1034,6 @@ "version": "https://registry.npmjs.org/isexe/-/isexe-1.1.2.tgz", "integrity": "sha1-NvPiLmB1CSD15yQaR2qMakInWtA=" }, - "isomorphic-fetch": { - "version": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", - "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=" - }, "isstream": { "version": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" @@ -1313,10 +1067,6 @@ "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true }, - "json-stringify-safe": { - "version": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", @@ -1337,10 +1087,6 @@ "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=", "dev": true }, - "lcid": { - "version": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=" - }, "levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", @@ -1353,38 +1099,6 @@ "integrity": "sha1-zajwvvFueSjMFLc1GGrhLNZiWZw=", "dev": true }, - "listr": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/listr/-/listr-0.12.0.tgz", - "integrity": "sha1-a84sD1YD+klYDqF81qAMwOX6RRo=", - "dev": true - }, - "listr-silent-renderer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz", - "integrity": "sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=", - "dev": true - }, - "listr-update-renderer": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.2.0.tgz", - "integrity": "sha1-yoDhd5tOcCZoB+ju0a1qvjmFUPk=", - "dev": true, - "dependencies": { - "indent-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.1.0.tgz", - "integrity": "sha1-CP9DNGAziDmbMp5rlTjcejz13n0=", - "dev": true - } - } - }, - "listr-verbose-renderer": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/listr-verbose-renderer/-/listr-verbose-renderer-0.4.0.tgz", - "integrity": "sha1-RNwBuww0oDxXIVTU0Izemx3FYg8=", - "dev": true - }, "load-json-file": { "version": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=" @@ -1407,16 +1121,6 @@ "version": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=" }, - "lodash.assign": { - "version": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", - "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=" - }, - "lodash.chunk": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.chunk/-/lodash.chunk-4.2.0.tgz", - "integrity": "sha1-ZuXOH3btJ7QwPYxlEujRIW6BBrw=", - "dev": true - }, "lodash.clonedeep": { "version": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" @@ -1427,18 +1131,6 @@ "integrity": "sha1-9HGh2khr5g9quVXRcRVSPdHSVdU=", "dev": true }, - "log-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", - "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", - "dev": true - }, - "log-update": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-1.0.2.tgz", - "integrity": "sha1-GZKfZMQJPS0ucHWh2tivWcKWuNE=", - "dev": true - }, "loose-envify": { "version": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.2.0.tgz", "integrity": "sha1-aaZarT3lQs9O4PT+dOjjPHCcyw8=" @@ -1832,10 +1524,6 @@ "version": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz", "integrity": "sha1-baWhdmjEs91ZYjvaEc9/pMH2Cm8=" }, - "nopt": { - "version": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=" - }, "normalize-package-data": { "version": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.3.5.tgz", "integrity": "sha1-jZJPFClg4Xd+f/4XBUNjHMfLAt8=" @@ -1851,24 +1539,6 @@ "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", "dev": true }, - "npm-path": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.3.tgz", - "integrity": "sha1-Fc/04ciaONp39W9gVbJPl137K74=", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true - }, - "npm-which": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", - "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", - "dev": true - }, "npmlog": { "version": "https://registry.npmjs.org/npmlog/-/npmlog-3.1.2.tgz", "integrity": "sha1-LUb6h0M3r5SYovErtD2NC+SjaHM=" @@ -1882,10 +1552,6 @@ "version": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.0.tgz", "integrity": "sha1-wCD1KcUoKt/dIz2R1LGBw9aG3Es=" }, - "oauth-sign": { - "version": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" - }, "object-assign": { "version": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.0.tgz", "integrity": "sha1-ejs9DpgGPUP0wD8uiubNUahog6A=" @@ -1920,20 +1586,10 @@ } } }, - "ora": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/ora/-/ora-0.2.3.tgz", - "integrity": "sha1-N1J9Igrc1Tw5tzVx11QVbV22V6Q=", - "dev": true - }, "os-homedir": { "version": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.1.tgz", "integrity": "sha1-DWK99EuRb9O73PLKsZGUj7CU8Ac=" }, - "os-locale": { - "version": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=" - }, "os-tmpdir": { "version": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz", "integrity": "sha1-6bQjoe2vR5iCVi6S7XHXdDoHG24=" @@ -1942,12 +1598,6 @@ "version": "https://registry.npmjs.org/osenv/-/osenv-0.1.3.tgz", "integrity": "sha1-g88FxtZFj8TVrGNi6jJdkvJ1Qhc=" }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, "p-limit": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", @@ -1960,12 +1610,6 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true }, - "p-map": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.1.1.tgz", - "integrity": "sha1-BfXkrpegaDcbwqXMhr+9vBnErno=", - "dev": true - }, "parse-json": { "version": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=" @@ -1988,12 +1632,6 @@ "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", "dev": true }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, "path-type": { "version": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=" @@ -2084,20 +1722,12 @@ } } }, - "process-nextick-args": { - "version": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" - }, "progress": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, - "promise": { - "version": "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz", - "integrity": "sha1-SJZUxpJha4qlWwck+oCbt9tJxb8=" - }, "prop-types": { "version": "https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz", "integrity": "sha1-J5ffwxJhguOpXj37suiT3ddFYVQ=", @@ -2112,10 +1742,6 @@ } } }, - "pseudomap": { - "version": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, "qs": { "version": "https://registry.npmjs.org/qs/-/qs-6.2.1.tgz", "integrity": "sha1-zgPF/wk1vB2daanxTL0Y5WjWdiU=" @@ -2194,12 +1820,6 @@ } } }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true - }, "redent": { "version": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=" @@ -2248,20 +1868,6 @@ "version": "https://registry.npmjs.org/request/-/request-2.74.0.tgz", "integrity": "sha1-dpPKdou7DqXIzgjAhKRe+gW4kqs=" }, - "require-directory": { - "version": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" - }, - "require-from-string": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz", - "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=", - "dev": true - }, - "require-main-filename": { - "version": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" - }, "require-uncached": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", @@ -2309,12 +1915,6 @@ "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", "dev": true }, - "rxjs": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.4.0.tgz", - "integrity": "sha1-p9sUqxV/nXqsalbmVeejhg05vyY=", - "dev": true - }, "safe-buffer": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", @@ -2339,18 +1939,6 @@ "version": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" }, - "semver": { - "version": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" - }, - "set-blocking": { - "version": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" - }, - "setimmediate": { - "version": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, "shelljs": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.7.tgz", @@ -2387,19 +1975,11 @@ "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", "dev": true }, - "sntp": { - "version": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=" - }, "source-map": { "version": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", "dev": true }, - "spdx-correct": { - "version": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=" - }, "spdx-exceptions": { "version": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-1.0.5.tgz", "integrity": "sha1-nSGsTaS9tx0GD7dOWmdTHQMsu6Y=" @@ -2408,15 +1988,6 @@ "version": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.2.tgz", "integrity": "sha1-1SsUtelnB3FECvIlvLVjEirEUvY=" }, - "spdx-license-ids": { - "version": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=" - }, - "sprintf-js": { - "version": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, "sshpk": { "version": "https://registry.npmjs.org/sshpk/-/sshpk-1.9.2.tgz", "integrity": "sha1-O0E1G7rVw03fS9gRmTfv7jGkZ2U=", @@ -2431,26 +2002,10 @@ "version": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz", "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=" }, - "staged-git-files": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/staged-git-files/-/staged-git-files-0.0.4.tgz", - "integrity": "sha1-15fhtVHKemOd7AI33G60u5vhfTU=", - "dev": true - }, "stream-parser": { "version": "https://registry.npmjs.org/stream-parser/-/stream-parser-0.3.1.tgz", "integrity": "sha1-FhhUhpRCACGhGC/wrxkRwSl2F3M=" }, - "stream-to-observable": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/stream-to-observable/-/stream-to-observable-0.1.0.tgz", - "integrity": "sha1-Rb8dny19wJvtgfHDB8Qw5ouEz/4=", - "dev": true - }, - "strict-uri-encode": { - "version": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" - }, "string_decoder": { "version": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" @@ -2459,10 +2014,6 @@ "version": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=" }, - "stringstream": { - "version": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" - }, "strip-ansi": { "version": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=" @@ -2471,12 +2022,6 @@ "version": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=" }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, "strip-indent": { "version": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=" @@ -2485,12 +2030,6 @@ "version": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, - "symbol-observable": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz", - "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=", - "dev": true - }, "table": { "version": "3.8.3", "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", @@ -2517,10 +2056,6 @@ } } }, - "tar": { - "version": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=" - }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -2575,10 +2110,6 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, - "ua-parser-js": { - "version": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.12.tgz", - "integrity": "sha1-BMgamb3V3FImPqKdJMa/jUgYpLs=" - }, "unzip-response": { "version": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=" @@ -2587,34 +2118,14 @@ "version": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=" }, - "util-deprecate": { - "version": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "validate-npm-package-license": { - "version": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=" - }, - "verror": { - "version": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", - "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=" - }, "warning": { "version": "https://registry.npmjs.org/warning/-/warning-3.0.0.tgz", "integrity": "sha1-MuU3fLVy3kqwR1O9+IIcAe1gW3w=" }, - "whatwg-fetch": { - "version": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", - "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=" - }, "which": { "version": "https://registry.npmjs.org/which/-/which-1.2.10.tgz", "integrity": "sha1-kc2b0HUTIkEbZZtA8FSyHelXqy0=" }, - "which-module": { - "version": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", - "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=" - }, "wide-align": { "version": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.0.tgz", "integrity": "sha1-QO3egCpx/qHwcNo+YtzaLnrdlq0=" @@ -2637,10 +2148,6 @@ "version": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.0.0.tgz", "integrity": "sha1-fTD4+HP5pbvDpk2ryNF34HGuQm8=" }, - "wrappy": { - "version": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, "write": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", @@ -2662,14 +2169,6 @@ } } }, - "xtend": { - "version": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, - "y18n": { - "version": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=" - }, "yallist": { "version": "https://registry.npmjs.org/yallist/-/yallist-2.0.0.tgz", "integrity": "sha1-MGxUODXwnuGkyyO3vOmrNByRzdQ=" From 19d89c6f928764608dccb4e7f9711c150e22deed Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Fri, 30 Jun 2017 10:58:49 -0400 Subject: [PATCH 06/28] trigger syncing with state from akka-apps --- .../bigbluebutton/SystemConfiguration.scala | 1 + .../core/BigBlueButtonActor.scala | 7 +++++ .../SyncGetMeetingInfoRespMsgHdlr.scala | 21 +++++++++++++ .../apps/presentation/PresentationApp2x.scala | 3 +- .../SyncGetPresentationInfoRespMsgHdlr.scala | 28 +++++++++++++++++ .../SyncGetUsersMeetingRespMsgHdlr.scala | 31 +++++++++++++++++++ .../core/apps/users/UsersApp2x.scala | 1 + .../senders/ReceivedJsonMsgHandlerActor.scala | 7 +++++ .../core/running/MeetingActor.scala | 18 +++++++++++ .../core2/FromAkkaAppsMsgSenderActor.scala | 10 ++++-- .../common2/msgs/PresentationMsgs.scala | 4 +++ .../common2/msgs/SystemMsgs.scala | 15 +++++++-- .../bigbluebutton/common2/msgs/UsersMgs.scala | 4 +++ .../imports/startup/server/redis2x.js | 15 +++++++++ .../private/config/server/redis.yaml | 1 + 15 files changed, 161 insertions(+), 5 deletions(-) create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/meeting/SyncGetMeetingInfoRespMsgHdlr.scala create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SyncGetPresentationInfoRespMsgHdlr.scala create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SyncGetUsersMeetingRespMsgHdlr.scala diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala index bf635d21f1..166cf19ebe 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/SystemConfiguration.scala @@ -36,6 +36,7 @@ trait SystemConfiguration { lazy val toAkkaAppsRedisChannel = Try(config.getString("redis.toAkkaAppsRedisChannel")).getOrElse("to-akka-apps-redis-channel") lazy val fromAkkaAppsRedisChannel = Try(config.getString("redis.fromAkkaAppsRedisChannel")).getOrElse("from-akka-apps-redis-channel") + lazy val toHTML5RedisChannel = Try(config.getString("redis.toHTML5RedisChannel")).getOrElse("to-html5-redis-channel") lazy val fromAkkaAppsChannel = Try(config.getString("eventBus.fromAkkaAppsChannel")).getOrElse("from-akka-apps-channel") lazy val toAkkaAppsChannel = Try(config.getString("eventBus.toAkkaAppsChannel")).getOrElse("to-akka-apps-channel") lazy val fromClientChannel = Try(config.getString("eventBus.fromClientChannel")).getOrElse("from-client-channel") diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala index 48ff45ba4e..485db97a82 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -74,6 +74,7 @@ class BigBlueButtonActor(val system: ActorSystem, msg.core match { case m: CreateMeetingReqMsg => handleCreateMeetingReqMsg(m) case m: RegisterUserReqMsg => handleRegisterUserReqMsg(m) + case m: GetAllMeetingsReqMsg => handleGetAllMeetingsReqMsg(m) case _ => log.warning("Cannot handle " + msg.envelope.name) } } @@ -135,6 +136,12 @@ class BigBlueButtonActor(val system: ActorSystem, } + private def handleGetAllMeetingsReqMsg(msg: GetAllMeetingsReqMsg): Unit = { + RunningMeetings.meetings(meetings).foreach(m => { + m.actorRef ! msg + }) + } + private def findMeetingWithVoiceConfId(voiceConfId: String): Option[RunningMeeting] = { RunningMeetings.findMeetingWithVoiceConfId(meetings, voiceConfId) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/meeting/SyncGetMeetingInfoRespMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/meeting/SyncGetMeetingInfoRespMsgHdlr.scala new file mode 100644 index 0000000000..ddf2e2dea0 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/meeting/SyncGetMeetingInfoRespMsgHdlr.scala @@ -0,0 +1,21 @@ +package org.bigbluebutton.core.apps.meeting + +import org.bigbluebutton.common2.domain.DefaultProps +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.common2.msgs._ + +trait SyncGetMeetingInfoRespMsgHdlr { + + val outGW: OutMessageGateway + + def handleSyncGetMeetingInfoRespMsg(props: DefaultProps): Unit = { + val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, props.meetingProp.intId, "nodeJSapp") + val envelope = BbbCoreEnvelope(SyncGetMeetingInfoRespMsg.NAME, routing) + val header = BbbCoreBaseHeader(SyncGetMeetingInfoRespMsg.NAME) + + val body = SyncGetMeetingInfoRespMsgBody(props) + val event = SyncGetMeetingInfoRespMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + outGW.send(msgEvent) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala index 8de5bba72a..27478372a7 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala @@ -21,7 +21,8 @@ class PresentationApp2x(val liveMeeting: LiveMeeting, with PresentationConversionUpdatePubMsgHdlr with PresentationPageCountErrorPubMsgHdlr with PresentationPageGeneratedPubMsgHdlr - with PresentationConversionCompletedPubMsgHdlr { + with PresentationConversionCompletedPubMsgHdlr + with SyncGetPresentationInfoRespMsgHdlr { val log = Logging(context.system, getClass) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SyncGetPresentationInfoRespMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SyncGetPresentationInfoRespMsgHdlr.scala new file mode 100644 index 0000000000..94ce4f9dde --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SyncGetPresentationInfoRespMsgHdlr.scala @@ -0,0 +1,28 @@ +package org.bigbluebutton.core.apps.presentation + +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.common2.domain.PresentationVO + +trait SyncGetPresentationInfoRespMsgHdlr { + this: PresentationApp2x => + + val outGW: OutMessageGateway + + def handleSyncGetPresentationInfoRespMsg(): Unit = { + log.debug("Handling SyncGetPresentationInfo") + + val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp") + val envelope = BbbCoreEnvelope(SyncGetPresentationInfoRespMsg.NAME, routing) + val header = BbbClientMsgHeader(SyncGetPresentationInfoRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp") + + val presVOs = getPresentationInfo().map { p => + PresentationVO(p.id, p.name, p.current, p.pages.values.toVector, p.downloadable) + } + + val body = SyncGetPresentationInfoRespMsgBody(presVOs) + val event = SyncGetPresentationInfoRespMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + outGW.send(msgEvent) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SyncGetUsersMeetingRespMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SyncGetUsersMeetingRespMsgHdlr.scala new file mode 100644 index 0000000000..8abb02d235 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SyncGetUsersMeetingRespMsgHdlr.scala @@ -0,0 +1,31 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.models.Users2x + +trait SyncGetUsersMeetingRespMsgHdlr { + this: UsersApp2x => + + val outGW: OutMessageGateway + + def handleSyncGetUsersMeetingRespMsg(): Unit = { + log.debug("Handling SyncGetUsersMeetingRespMsg") + + val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, "nodeJSapp") + val envelope = BbbCoreEnvelope(SyncGetUsersMeetingRespMsg.NAME, routing) + val header = BbbClientMsgHeader(SyncGetUsersMeetingRespMsg.NAME, liveMeeting.props.meetingProp.intId, "nodeJSapp") + + val users = Users2x.findAll(liveMeeting.users2x) + val webUsers = users.map { u => + WebUser(intId = u.intId, extId = u.extId, name = u.name, role = u.role, + guest = u.guest, authed = u.authed, waitingForAcceptance = u.waitingForAcceptance, emoji = u.emoji, + locked = u.locked, presenter = u.presenter, avatar = u.avatar) + } + + val body = SyncGetUsersMeetingRespMsgBody(webUsers) + val event = SyncGetUsersMeetingRespMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + outGW.send(msgEvent) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala index ab13072ae7..f747e8e03e 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala @@ -8,6 +8,7 @@ import org.bigbluebutton.core.running.LiveMeeting class UsersApp2x(val liveMeeting: LiveMeeting, val outGW: OutMessageGateway)(implicit val context: ActorContext) extends ChangeUserRoleHdlr + with SyncGetUsersMeetingRespMsgHdlr with EjectUserFromMeetingHdlr { val log = Logging(context.system, getClass) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index fa811677d0..fbf6ee5990 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -75,6 +75,13 @@ class ReceivedJsonMsgHandlerActor( } yield { send(m.header.userId, envelope, m) } + case GetAllMeetingsReqMsg.NAME => + // for { + // m <- deserialize[GetAllMeetingsReqMsg](jsonNode) + // } yield { + route[GetAllMeetingsReqMsg](meetingManagerChannel, envelope, jsonNode) + // } + case StartCustomPollReqMsg.NAME => for { m <- deserialize[StartCustomPollReqMsg](jsonNode) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index 2492fe5e3a..39af98eda1 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -12,6 +12,7 @@ import org.bigbluebutton.core.apps._ import org.bigbluebutton.core.apps.caption.CaptionApp2x import org.bigbluebutton.core.apps.deskshare.DeskshareApp2x import org.bigbluebutton.core.apps.presentation.PresentationApp2x +import org.bigbluebutton.core.apps.meeting._ import org.bigbluebutton.core.apps.presentation.poll.PollApp2x import org.bigbluebutton.core.apps.users.UsersApp2x import org.bigbluebutton.core.bus._ @@ -75,6 +76,7 @@ class MeetingActor(val props: DefaultProps, with UserTalkingInVoiceConfEvtMsgHdlr with GetCurrentLayoutMsgHdlr with LockLayoutMsgHdlr + with SyncGetMeetingInfoRespMsgHdlr with BroadcastLayoutMsgHdlr { override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) { @@ -115,6 +117,7 @@ class MeetingActor(val props: DefaultProps, // 2x messages case msg: BbbCommonEnvCoreMsg => handleBbbCommonEnvCoreMsg(msg) case msg: RegisterUserReqMsg => handleRegisterUserReqMsg(msg) + case m: GetAllMeetingsReqMsg => handleGetAllMeetingsReqMsg(m) //====================================== @@ -269,6 +272,21 @@ class MeetingActor(val props: DefaultProps, } } + def handleGetAllMeetingsReqMsg(msg: GetAllMeetingsReqMsg): Unit = { + // sync all meetings + handleSyncGetMeetingInfoRespMsg(liveMeeting.props) + + // sync all users + usersApp2x.handleSyncGetUsersMeetingRespMsg() + + // sync all presentations + presentationApp2x.handleSyncGetPresentationInfoRespMsg() + + // TODO send all chat + // TODO send all lock settings + // TODO send all screen sharing info + } + def handleDeskShareRTMPBroadcastStoppedRequest(msg: DeskShareRTMPBroadcastStoppedRequest): Unit = { log.info("handleDeskShareRTMPBroadcastStoppedRequest: isBroadcastingRTMP=" + MeetingStatus2x.isBroadcastingRTMP(liveMeeting.status) + " URL:" + diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/FromAkkaAppsMsgSenderActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/FromAkkaAppsMsgSenderActor.scala index e76370c21e..e802c4bf8b 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/FromAkkaAppsMsgSenderActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/FromAkkaAppsMsgSenderActor.scala @@ -2,7 +2,7 @@ package org.bigbluebutton.core2 import akka.actor.{ Actor, ActorLogging, Props } import org.bigbluebutton.SystemConfiguration -import org.bigbluebutton.common2.msgs.BbbCommonEnvCoreMsg +import org.bigbluebutton.common2.msgs.{ BbbCommonEnvCoreMsg, SyncGetMeetingInfoRespMsg, SyncGetPresentationInfoRespMsg, SyncGetUsersMeetingRespMsg } import org.bigbluebutton.common2.util.JsonUtil import org.bigbluebutton.core.MessageSender @@ -20,6 +20,12 @@ class FromAkkaAppsMsgSenderActor(msgSender: MessageSender) def handleBbbCommonEnvCoreMsg(msg: BbbCommonEnvCoreMsg): Unit = { val json = JsonUtil.toJson(msg) - msgSender.send(fromAkkaAppsRedisChannel, json) + + msg.envelope.name match { + case SyncGetPresentationInfoRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json) + case SyncGetMeetingInfoRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json) + case SyncGetUsersMeetingRespMsg.NAME => msgSender.send(toHTML5RedisChannel, json) + case _ => msgSender.send(fromAkkaAppsRedisChannel, json) + } } } diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala index 02f2dee830..2dbf593c10 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala @@ -66,6 +66,10 @@ import org.bigbluebutton.common2.domain.PresentationVO case class GetPresentationInfoRespMsg(header: BbbClientMsgHeader, body: GetPresentationInfoRespMsgBody) extends BbbCoreMsg case class GetPresentationInfoRespMsgBody(presentations: Vector[PresentationVO]) + object SyncGetPresentationInfoRespMsg { val NAME = "SyncGetPresentationInfoRespMsg"} + case class SyncGetPresentationInfoRespMsg(header: BbbClientMsgHeader, body: SyncGetPresentationInfoRespMsgBody) extends BbbCoreMsg + case class SyncGetPresentationInfoRespMsgBody(presentations: Vector[PresentationVO]) + object SetCurrentPageEvtMsg { val NAME = "SetCurrentPageEvtMsg"} case class SetCurrentPageEvtMsg(header: BbbClientMsgHeader, body: SetCurrentPageEvtMsgBody) extends BbbCoreMsg case class SetCurrentPageEvtMsgBody(presentationId: String, pageId: String) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala index a0a8d302d1..0b033cf065 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala @@ -3,19 +3,30 @@ package org.bigbluebutton.common2.msgs import org.bigbluebutton.common2.domain.DefaultProps - +/** Request Messages **/ object CreateMeetingReqMsg { val NAME = "CreateMeetingReqMsg" } case class CreateMeetingReqMsg(header: BbbCoreBaseHeader, body: CreateMeetingReqMsgBody) extends BbbCoreMsg - case class CreateMeetingReqMsgBody(props: DefaultProps) + + object GetAllMeetingsReqMsg { val NAME = "GetAllMeetingsReqMsg" } + case class GetAllMeetingsReqMsg(header: BbbCoreBaseHeader, + body: GetAllMeetingsReqMsgBody) extends BbbCoreMsg + case class GetAllMeetingsReqMsgBody(requesterId: String) + + + /** Response Messages **/ object MeetingCreatedEvtMsg { val NAME = "MeetingCreatedEvtMsg"} case class MeetingCreatedEvtMsg(header: BbbCoreBaseHeader, body: MeetingCreatedEvtBody) extends BbbCoreMsg case class MeetingCreatedEvtBody(props: DefaultProps) + object SyncGetMeetingInfoRespMsg { val NAME = "SyncGetMeetingInfoRespMsg"} + case class SyncGetMeetingInfoRespMsg(header: BbbCoreBaseHeader, + body: SyncGetMeetingInfoRespMsgBody) extends BbbCoreMsg + case class SyncGetMeetingInfoRespMsgBody(props: DefaultProps) /** System Messages **/ diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala index 0e40c6aae6..384131d34e 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala @@ -119,6 +119,10 @@ object GetUsersMeetingRespMsg { } +object SyncGetUsersMeetingRespMsg { val NAME = "SyncGetUsersMeetingRespMsg"} +case class SyncGetUsersMeetingRespMsg(header: BbbClientMsgHeader, body: SyncGetUsersMeetingRespMsgBody) extends BbbCoreMsg +case class SyncGetUsersMeetingRespMsgBody(users: Vector[WebUser]) + case class GetUsersMeetingRespMsg(header: BbbClientMsgHeader, body: GetUsersMeetingRespMsgBody) extends BbbCoreMsg case class GetUsersMeetingRespMsgBody(users: Vector[WebUser]) diff --git a/bigbluebutton-html5/imports/startup/server/redis2x.js b/bigbluebutton-html5/imports/startup/server/redis2x.js index 49120bab35..ee80620e55 100644 --- a/bigbluebutton-html5/imports/startup/server/redis2x.js +++ b/bigbluebutton-html5/imports/startup/server/redis2x.js @@ -26,6 +26,7 @@ class RedisPubSub2x { this.queue.reset(); this.sub.psubscribe(this.config.channels.fromAkkaApps); // 2.0 + this.sub.psubscribe(this.config.channels.toHTML5); // 2.0 Logger.info(`Subscribed to '${this.config.channels.fromBBBApps}'`); } @@ -72,6 +73,20 @@ class RedisPubSub2x { handleSubscribe() { if (this.didSendRequestEvent) return; + // populate collections with pre-existing data + const REDIS_CONFIG = Meteor.settings.redis; + const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; + const EVENT_NAME = 'GetAllMeetingsReqMsg'; + + const body = { + requesterId: "nodeJSapp", + }; + + const header = { + name: EVENT_NAME, + }; + + this.publish(CHANNEL, EVENT_NAME, "someMeetingId", body, header); this.didSendRequestEvent = true; } diff --git a/bigbluebutton-html5/private/config/server/redis.yaml b/bigbluebutton-html5/private/config/server/redis.yaml index bc88ac7c04..c2088d49b8 100755 --- a/bigbluebutton-html5/private/config/server/redis.yaml +++ b/bigbluebutton-html5/private/config/server/redis.yaml @@ -8,6 +8,7 @@ redis: fromBBBUsers: 'bigbluebutton:from-bbb-apps:users' fromAkkaApps: 'from-akka-apps-redis-channel' toAkkaApps: 'to-akka-apps-redis-channel' + toHTML5: 'to-html5-redis-channel' toBBBApps: pattern: 'bigbluebutton:to-bbb-apps:*' html5: 'bigbluebutton:to-bbb-html5' From 83e14e8206d00feb4c5c8e5b8702e52cb25bf464 Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Fri, 30 Jun 2017 15:16:00 -0400 Subject: [PATCH 07/28] handle slides messages --- .../api/2.0/presentations/server/eventHandlers.js | 6 ++++-- .../server/handlers/presentationInfoReply.js | 11 ++--------- .../server/modifiers/addPresentation.js | 1 - .../api/2.0/presentations/server/publishers.js | 3 +-- .../imports/api/2.0/slides/server/eventHandlers.js | 6 +++--- .../api/2.0/slides/server/handlers/slideChange.js | 14 +++++--------- .../imports/api/2.0/slides/server/methods.js | 4 ++-- .../api/2.0/slides/server/methods/switchSlide.js | 2 +- .../api/2.0/slides/server/modifiers/addSlide.js | 3 +-- .../imports/api/2.0/slides/server/publishers.js | 2 +- .../imports/startup/client/base.jsx | 2 +- .../imports/startup/server/redis2x.js | 6 +++--- .../imports/ui/components/media/service.js | 6 ++---- .../imports/ui/components/nav-bar/container.jsx | 2 +- .../ui/components/presentation/component.jsx | 10 +++++----- .../presentation/presentation-toolbar/service.js | 6 +++--- .../imports/ui/components/presentation/service.js | 4 ++-- bigbluebutton-html5/server/main.js | 4 +++- 18 files changed, 40 insertions(+), 52 deletions(-) diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js index 157ac05ade..eaa8d1d826 100644 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js @@ -1,8 +1,10 @@ -import RedisPubSub from '/imports/startup/server/redis'; +import RedisPubSub from '/imports/startup/server/redis2x'; // import handlePresentationRemove from './handlers/presentationRemove'; import handlePresentationChange from './handlers/presentationChange'; -// import handlePresentationInfoReply from './handlers/presentationInfoReply'; +import handlePresentationInfoReply from './handlers/presentationInfoReply'; // RedisPubSub.on('presentation_removed_message', handlePresentationRemove); RedisPubSub.on('NewPresentationEvtMsg', handlePresentationChange); // RedisPubSub.on('get_presentation_info_reply', handlePresentationInfoReply); + +RedisPubSub.on('SyncGetPresentationInfoRespMsg', handlePresentationInfoReply); diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js index 1efd4469ed..42d366b16f 100644 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js @@ -1,19 +1,12 @@ import { check } from 'meteor/check'; -import { inReplyToHTML5Client } from '/imports/api/common/server/helpers'; import Presentations from '/imports/api/2.0/presentations'; import addPresentation from '../modifiers/addPresentation'; import removePresentation from '../modifiers/removePresentation'; -export default function handlePresentationInfoReply({ payload }) { - if (!inReplyToHTML5Client({ payload })) { - return; - } +export default function handlePresentationInfoReply({ body }, meetingId) { + const presentations = body.presentations; - const meetingId = payload.meeting_id; - const presentations = payload.presentations; - - check(meetingId, String); check(presentations, Array); const presentationsIds = presentations.map(_ => _.id); diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js index e2fc341067..40e23bb0dc 100755 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/modifiers/addPresentation.js @@ -15,7 +15,6 @@ const addSlides = (meetingId, presentationId, slides) => { }; export default function addPresentation(meetingId, presentation) { - check(meetingId, String); check(presentation, Object); const selector = { diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js index 254f368cb7..11f12a6f31 100755 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js @@ -21,5 +21,4 @@ function publish(...args) { return mapToAcl('subscriptions.presentations', boundPresentations)(args); } -Meteor.publish('presentations', publish); - +Meteor.publish('presentations2x', publish); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js index 74f5d0c653..0fee6f6aca 100644 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/eventHandlers.js @@ -1,6 +1,6 @@ -// import RedisPubSub from '/imports/startup/server/redis'; +import RedisPubSub from '/imports/startup/server/redis2x'; // import handleSlideResize from './handlers/slideResize'; -// import handleSlideChange from './handlers/slideChange'; +import handleSlideChange from './handlers/slideChange'; // RedisPubSub.on('presentation_page_resized_message', handleSlideResize); -// RedisPubSub.on('presentation_page_changed_message', handleSlideChange); +RedisPubSub.on('SetCurrentPageEvtMsg', handleSlideChange); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js index 288aa46763..5cc819ea05 100644 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/handlers/slideChange.js @@ -1,15 +1,11 @@ import { check } from 'meteor/check'; import changeCurrentSlide from '../modifiers/changeCurrentSlide'; -export default function handleSlideChange({ payload }) { - const meetingId = payload.meeting_id; - const slide = payload.page; +export default function handleSlideChange({ body }, meetingId) { + const { pageId, presentationId } = body; - check(meetingId, String); - check(slide, Object); + check(pageId, String); + check(presentationId, String); - const slideId = slide.id; - const presentationId = slideId.split('/')[0]; - - return changeCurrentSlide(meetingId, presentationId, slideId); + return changeCurrentSlide(meetingId, presentationId, pageId); } diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/methods.js b/bigbluebutton-html5/imports/api/2.0/slides/server/methods.js index 058a832332..04807692af 100644 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/methods.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/methods.js @@ -3,6 +3,6 @@ import mapToAcl from '/imports/startup/mapToAcl'; import switchSlide from './methods/switchSlide'; Meteor.methods(mapToAcl(['methods.switchSlide', 'methods.switchSlideMessage'], { - switchSlide, - switchSlideMessage: switchSlide, // legacy + // switchSlide, + // switchSlideMessage: switchSlide, // legacy })); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js b/bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js index 22c537602b..dc2467ea55 100755 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/methods/switchSlide.js @@ -2,7 +2,7 @@ import Presentations from '/imports/api/2.0/presentations'; import Slides from '/imports/api/2.0/slides'; import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; -import RedisPubSub from '/imports/startup/server/redis'; +import RedisPubSub from '/imports/startup/server/redis2x'; export default function switchSlide(credentials, slideNumber) { const REDIS_CONFIG = Meteor.settings.redis; diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js index dab4dc618b..7f3f474a75 100755 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/modifiers/addSlide.js @@ -1,7 +1,7 @@ import probe from 'probe-image-size'; import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; -import RedisPubSub from '/imports/startup/server/redis'; +import RedisPubSub from '/imports/startup/server/redis2x'; import Slides from '/imports/api/2.0/slides'; import Logger from '/imports/startup/server/logger'; import { SVG, PNG } from '/imports/utils/mimeTypes'; @@ -41,7 +41,6 @@ const fetchImageSizes = imageUri => }); export default function addSlide(meetingId, presentationId, slide) { - check(meetingId, String); check(presentationId, String); check(slide, Object); diff --git a/bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js b/bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js index 581a539ab1..1bc992720f 100644 --- a/bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js +++ b/bigbluebutton-html5/imports/api/2.0/slides/server/publishers.js @@ -21,4 +21,4 @@ function publish(...args) { return mapToAcl('subscriptions.slides', boundSlides)(args); } -Meteor.publish('slides', publish); +Meteor.publish('slides2x', publish); diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 4d7ff8c99e..8fe54898f4 100644 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -85,7 +85,7 @@ Base.defaultProps = defaultProps; const SUBSCRIPTIONS_NAME = [ 'users2x', 'users', 'chat', 'cursor', 'cursor2x', 'deskshare', 'meetings', 'meetings2x', - 'polls', 'presentations', 'shapes', 'shapes2x', 'slides', 'captions', 'breakouts', + 'polls', 'presentations', 'presentations2x', 'shapes', 'shapes2x', 'slides', 'slides2x', 'captions', 'breakouts', ]; const BaseContainer = createContainer(({ params }) => { diff --git a/bigbluebutton-html5/imports/startup/server/redis2x.js b/bigbluebutton-html5/imports/startup/server/redis2x.js index ee80620e55..260960bce9 100644 --- a/bigbluebutton-html5/imports/startup/server/redis2x.js +++ b/bigbluebutton-html5/imports/startup/server/redis2x.js @@ -79,19 +79,19 @@ class RedisPubSub2x { const EVENT_NAME = 'GetAllMeetingsReqMsg'; const body = { - requesterId: "nodeJSapp", + requesterId: 'nodeJSapp', }; const header = { name: EVENT_NAME, }; - this.publish(CHANNEL, EVENT_NAME, "someMeetingId", body, header); + this.publish(CHANNEL, EVENT_NAME, 'someMeetingId', body, header); this.didSendRequestEvent = true; } handleMessage(pattern, channel, message) { - Logger.error(`2.0 handleMessage: ${message}`); + Logger.warn(`2.0 handleMessage: ${message}`); const parsedMessage = JSON.parse(message); const { header } = parsedMessage.core; const eventName = header.name; diff --git a/bigbluebutton-html5/imports/ui/components/media/service.js b/bigbluebutton-html5/imports/ui/components/media/service.js index cb6b26656b..b2705f4a02 100755 --- a/bigbluebutton-html5/imports/ui/components/media/service.js +++ b/bigbluebutton-html5/imports/ui/components/media/service.js @@ -1,10 +1,8 @@ -import Presentations from '/imports/api/1.1/presentations'; -import Slides from '/imports/api/1.1/slides'; +import Presentations from '/imports/api/2.0/presentations'; import { isVideoBroadcasting } from '../deskshare/service'; const getPresentationInfo = () => { - let currentPresentation; - currentPresentation = Presentations.findOne({ + const currentPresentation = Presentations.findOne({ 'presentation.current': true, }); diff --git a/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx b/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx index 8a20e124aa..021b072494 100755 --- a/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/nav-bar/container.jsx @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { createContainer } from 'meteor/react-meteor-data'; import { withRouter } from 'react-router'; -import Meetings from '/imports/api/1.1/meetings'; +import Meetings from '/imports/api/2.0/meetings'; import Auth from '/imports/ui/services/auth'; import userListService from '../user-list/service'; import ChatService from '../chat/service'; diff --git a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx index 6bd11413e1..83be79aadf 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx @@ -1,12 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; -import ShapeGroupContainer from '../whiteboard/shape-group/container.jsx'; -import Cursor from './cursor/component.jsx'; -import PresentationToolbarContainer from './presentation-toolbar/container.jsx'; -import Slide from './slide/component.jsx'; -import styles from './styles.scss'; import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup'; import PollingContainer from '/imports/ui/components/polling/container'; +import ShapeGroupContainer from '../whiteboard/shape-group/container'; +import Cursor from './cursor/component'; +import PresentationToolbarContainer from './presentation-toolbar/container'; +import Slide from './slide/component'; +import styles from './styles.scss'; export default class PresentationArea extends React.Component { constructor(props) { diff --git a/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/service.js b/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/service.js index 923af1a359..392a74dd42 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/service.js +++ b/bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/service.js @@ -1,7 +1,7 @@ -import AuthSingleton from '/imports/ui/services/auth/index.js'; +import AuthSingleton from '/imports/ui/services/auth'; import Users from '/imports/api/2.0/users'; -import Slides from '/imports/api/1.1/slides'; -import { makeCall } from '/imports/ui/services/api/index.js'; +import Slides from '/imports/api/2.0/slides'; +import { makeCall } from '/imports/ui/services/api'; const getSlideData = (params) => { const { currentSlideNum, presentationId } = params; diff --git a/bigbluebutton-html5/imports/ui/components/presentation/service.js b/bigbluebutton-html5/imports/ui/components/presentation/service.js index f9d20ddf21..b5b4ebec4f 100755 --- a/bigbluebutton-html5/imports/ui/components/presentation/service.js +++ b/bigbluebutton-html5/imports/ui/components/presentation/service.js @@ -1,5 +1,5 @@ -import Presentations from '/imports/api/1.1/presentations'; -import Slides from '/imports/api/1.1/slides'; +import Presentations from '/imports/api/2.0/presentations'; +import Slides from '/imports/api/2.0/slides'; import Cursor from '/imports/api/2.0/cursor'; import Users from '/imports/api/2.0/users'; import Auth from '/imports/ui/services/auth'; diff --git a/bigbluebutton-html5/server/main.js b/bigbluebutton-html5/server/main.js index c8fe0b7d0b..30fa511fcf 100755 --- a/bigbluebutton-html5/server/main.js +++ b/bigbluebutton-html5/server/main.js @@ -16,8 +16,10 @@ import '/imports/api/2.0/meetings/server'; import '/imports/api/2.0/users/server'; import '/imports/api/2.0/shapes/server'; import '/imports/api/2.0/cursor/server'; +import '/imports/api/2.0/presentations/server'; +import '/imports/api/2.0/slides/server'; -//Commons +// Commons import '/imports/api/log-client/server'; import '/imports/api/common/server/helpers'; import '/imports/startup/server/logger'; From 86d3e27d474040151aa7e24d1bdec0d4d1762df7 Mon Sep 17 00:00:00 2001 From: Klaus Date: Mon, 3 Jul 2017 12:05:35 -0300 Subject: [PATCH 08/28] Merged info with anton's branch --- .../api/2.0/meetings/server/eventHandlers.js | 17 ++-------- .../server/handlers/getAllMeetings.js | 10 ++++++ .../2.0/presentations/server/eventHandlers.js | 6 +--- .../server/handlers/presentationInfoReply.js | 11 +++++-- .../2.0/presentations/server/publishers.js | 2 +- .../api/2.0/users/server/eventHandlers.js | 2 ++ .../api/2.0/users/server/handlers/getUsers.js | 32 +++++++++++++++++++ .../2.0/users/server/modifiers/clearUsers.js | 10 ++++++ .../imports/api/common/server/helpers.js | 4 +-- .../imports/startup/server/redis2x.js | 3 +- 10 files changed, 70 insertions(+), 27 deletions(-) create mode 100644 bigbluebutton-html5/imports/api/2.0/meetings/server/handlers/getAllMeetings.js create mode 100644 bigbluebutton-html5/imports/api/2.0/users/server/handlers/getUsers.js create mode 100755 bigbluebutton-html5/imports/api/2.0/users/server/modifiers/clearUsers.js diff --git a/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js index 5249e2648e..10180961ee 100644 --- a/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/meetings/server/eventHandlers.js @@ -1,20 +1,7 @@ import RedisPubSub from '/imports/startup/server/redis2x'; -// import handleMeetingDestruction from './handlers/meetingDestruction'; -// import handleRecordingStatusChange from './handlers/recordingStatusChange'; -// import handlePermissionSettingsChange from './handlers/permissionSettingsChange'; import handleMeetingCreation from './handlers/meetingCreation'; -// import handleGetAllMeetings from './handlers/getAllMeetings'; -// import handleStunTurnReply from './handlers/stunTurnReply'; - -// RedisPubSub.on('meeting_destroyed_event', handleMeetingDestruction); -// RedisPubSub.on('meeting_ended_message', handleMeetingDestruction); -// RedisPubSub.on('end_and_kick_all_message', handleMeetingDestruction); -// RedisPubSub.on('disconnect_all_users_message', handleMeetingDestruction); -// RedisPubSub.on('recording_status_changed_message', handleRecordingStatusChange); -// RedisPubSub.on('new_permission_settings', handlePermissionSettingsChange); -// RedisPubSub.on('meeting_created_message', handleMeetingCreation); -// RedisPubSub.on('get_all_meetings_reply_message', handleGetAllMeetings); -// RedisPubSub.on('send_stun_turn_info_reply_message', handleStunTurnReply); +import handleGetAllMeetings from './handlers/getAllMeetings'; // 2x RedisPubSub.on('MeetingCreatedEvtMsg', handleMeetingCreation); +RedisPubSub.on('SyncGetMeetingInfoRespMsg', handleGetAllMeetings); diff --git a/bigbluebutton-html5/imports/api/2.0/meetings/server/handlers/getAllMeetings.js b/bigbluebutton-html5/imports/api/2.0/meetings/server/handlers/getAllMeetings.js new file mode 100644 index 0000000000..15c5530a89 --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/meetings/server/handlers/getAllMeetings.js @@ -0,0 +1,10 @@ +import { inReplyToHTML5Client } from '/imports/api/common/server/helpers'; +import handleMeetingCreation from './meetingCreation'; + +export default function handleGetAllMeetings({ envelope, body }) { + if (!inReplyToHTML5Client(envelope)) { + return; + } + + return handleMeetingCreation({ body }); +} diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js index eaa8d1d826..293ad83707 100644 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/eventHandlers.js @@ -1,10 +1,6 @@ import RedisPubSub from '/imports/startup/server/redis2x'; -// import handlePresentationRemove from './handlers/presentationRemove'; import handlePresentationChange from './handlers/presentationChange'; import handlePresentationInfoReply from './handlers/presentationInfoReply'; -// RedisPubSub.on('presentation_removed_message', handlePresentationRemove); -RedisPubSub.on('NewPresentationEvtMsg', handlePresentationChange); -// RedisPubSub.on('get_presentation_info_reply', handlePresentationInfoReply); - RedisPubSub.on('SyncGetPresentationInfoRespMsg', handlePresentationInfoReply); +RedisPubSub.on('NewPresentationEvtMsg', handlePresentationChange); diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js index 42d366b16f..6ee1a89dd0 100644 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/handlers/presentationInfoReply.js @@ -1,15 +1,22 @@ import { check } from 'meteor/check'; import Presentations from '/imports/api/2.0/presentations'; +import { inReplyToHTML5Client } from '/imports/api/common/server/helpers'; import addPresentation from '../modifiers/addPresentation'; import removePresentation from '../modifiers/removePresentation'; -export default function handlePresentationInfoReply({ body }, meetingId) { +export default function handlePresentationInfoReply({ envelope, body }, meetingId) { + if (!inReplyToHTML5Client(envelope)) { + return; + } + const presentations = body.presentations; + check(meetingId, String); check(presentations, Array); - const presentationsIds = presentations.map(_ => _.id); + const presentationsIds = presentations.map(presentation => presentation.id); + const presentationsToRemove = Presentations.find({ meetingId, 'presentation.id': { $nin: presentationsIds }, diff --git a/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js b/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js index 11f12a6f31..7852e78adf 100755 --- a/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js +++ b/bigbluebutton-html5/imports/api/2.0/presentations/server/publishers.js @@ -11,7 +11,7 @@ function presentations(credentials) { check(requesterUserId, String); check(requesterToken, String); - Logger.info(`Publishing Presentations for ${meetingId} ${requesterUserId} ${requesterToken}`); + Logger.info(`Publishing Presentations2x for ${meetingId} ${requesterUserId} ${requesterToken}`); return Presentations.find({ meetingId }); } diff --git a/bigbluebutton-html5/imports/api/2.0/users/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/users/server/eventHandlers.js index dee6032391..6bb849ce15 100644 --- a/bigbluebutton-html5/imports/api/2.0/users/server/eventHandlers.js +++ b/bigbluebutton-html5/imports/api/2.0/users/server/eventHandlers.js @@ -5,6 +5,7 @@ import handleValidateAuthToken from './handlers/validateAuthToken'; import handleVoiceUpdate from './handlers/voiceUpdate'; import handlePresenterAssigned from './handlers/presenterAssigned'; import handleEmojiStatus from './handlers/emojiStatus'; +import handleGetUsers from './handlers/getUsers'; RedisPubSub.on('PresenterAssignedEvtMsg', handlePresenterAssigned); RedisPubSub.on('UserJoinedMeetingEvtMsg', handleUserJoined); @@ -13,3 +14,4 @@ RedisPubSub.on('UserLeftVoiceConfToClientEvtMsg', handleVoiceUpdate); RedisPubSub.on('UserJoinedVoiceConfToClientEvtMsg', handleVoiceUpdate); RedisPubSub.on('ValidateAuthTokenRespMsg', handleValidateAuthToken); RedisPubSub.on('UserEmojiChangedEvtMsg', handleEmojiStatus); +RedisPubSub.on('SyncGetUsersMeetingRespMsg', handleGetUsers); diff --git a/bigbluebutton-html5/imports/api/2.0/users/server/handlers/getUsers.js b/bigbluebutton-html5/imports/api/2.0/users/server/handlers/getUsers.js new file mode 100644 index 0000000000..bf8d3d005d --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/users/server/handlers/getUsers.js @@ -0,0 +1,32 @@ +import { check } from 'meteor/check'; +import Logger from '/imports/startup/server/logger'; +import Users from '/imports/api/2.0/users/'; +import addUser from '../modifiers/addUser'; +import removeUser from '../modifiers/removeUser'; +import { inReplyToHTML5Client } from '/imports/api/common/server/helpers'; + +export default function handleGetUsers({ envelope, body }, meetingId) { + if (!inReplyToHTML5Client(envelope)) { + return; + } + const { users } = body; + + check(meetingId, String); + check(users, Array); + + const usersIds = users.map(m => m.intId); + + const usersToRemove = Users.find({ + meetingId, + userId: { $nin: usersIds }, + }).fetch(); + + usersToRemove.forEach(user => removeUser(meetingId, user.userId)); + + const usersAdded = []; + users.forEach((user) => { + usersAdded.push(addUser(meetingId, user)); + }); + + return usersAdded; +} diff --git a/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/clearUsers.js b/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/clearUsers.js new file mode 100755 index 0000000000..b1c075e3fc --- /dev/null +++ b/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/clearUsers.js @@ -0,0 +1,10 @@ +import Users from './../../'; +import Logger from '/imports/startup/server/logger'; + +export default function clearUsers(meetingId) { + if (meetingId) { + return Users.remove({ meetingId }, Logger.info(`Cleared Users (${meetingId})`)); + } + + return Users.remove({}, Logger.info('Cleared Users (all)')); +} diff --git a/bigbluebutton-html5/imports/api/common/server/helpers.js b/bigbluebutton-html5/imports/api/common/server/helpers.js index 0d6100620c..9d65f301a6 100755 --- a/bigbluebutton-html5/imports/api/common/server/helpers.js +++ b/bigbluebutton-html5/imports/api/common/server/helpers.js @@ -35,8 +35,6 @@ export const translateHTML5ToFlash = function (message) { return result; }; -// when requesting for history information we pass this made up requesterID -// We want to handle only the reports we requested export const inReplyToHTML5Client = function (arg) { - return arg.payload.requester_id === 'nodeJSapp'; + return arg.routing.userId === 'nodeJSapp'; }; diff --git a/bigbluebutton-html5/imports/startup/server/redis2x.js b/bigbluebutton-html5/imports/startup/server/redis2x.js index 260960bce9..0ee064caa1 100644 --- a/bigbluebutton-html5/imports/startup/server/redis2x.js +++ b/bigbluebutton-html5/imports/startup/server/redis2x.js @@ -109,6 +109,7 @@ class RedisPubSub2x { handleTask(data, next) { const { header } = data.parsedMessage.core; const { body } = data.parsedMessage.core; + const { envelope } = data.parsedMessage; const eventName = header.name; const meetingId = header.meetingId; @@ -118,7 +119,7 @@ class RedisPubSub2x { try { this._debug(`${eventName} emitted`); return this.emitter - .emitAsync(eventName, { header, body }, meetingId) + .emitAsync(eventName, { envelope, header, body }, meetingId) .then((_) => { this._debug(`${eventName} completed`); return next(); From 6f76fd30c6959a587e290f2ec8e61b2075b7bbc7 Mon Sep 17 00:00:00 2001 From: Oswaldo Acauan Date: Tue, 4 Jul 2017 09:40:02 -0300 Subject: [PATCH 09/28] Upgrade Meteor to 1.5 --- .../.meteor/.finished-upgraders | 1 + bigbluebutton-html5/.meteor/packages | 11 +-- bigbluebutton-html5/.meteor/release | 2 +- bigbluebutton-html5/.meteor/versions | 69 ++++++++++--------- 4 files changed, 44 insertions(+), 39 deletions(-) diff --git a/bigbluebutton-html5/.meteor/.finished-upgraders b/bigbluebutton-html5/.meteor/.finished-upgraders index ce276f3a33..910574ce2d 100644 --- a/bigbluebutton-html5/.meteor/.finished-upgraders +++ b/bigbluebutton-html5/.meteor/.finished-upgraders @@ -14,3 +14,4 @@ notices-for-facebook-graph-api-2 1.4.0-remove-old-dev-bundle-link 1.4.1-add-shell-server-package 1.4.3-split-account-service-packages +1.5-add-dynamic-import-package diff --git a/bigbluebutton-html5/.meteor/packages b/bigbluebutton-html5/.meteor/packages index 311c283aa4..d15d36b747 100644 --- a/bigbluebutton-html5/.meteor/packages +++ b/bigbluebutton-html5/.meteor/packages @@ -15,10 +15,11 @@ cfs:power-queue cfs:reactive-list cfs:micro-queue reactive-var@1.0.11 -ecmascript@0.6.3 +ecmascript@0.8.0 react-meteor-data -standard-minifier-css@1.3.3 -standard-minifier-js@1.2.2 +standard-minifier-css@1.3.4 +standard-minifier-js@2.1.0 nathantreid:css-modules -shell-server@0.2.2 -http@1.2.11 +shell-server@0.2.3 +http@1.2.12 +dynamic-import diff --git a/bigbluebutton-html5/.meteor/release b/bigbluebutton-html5/.meteor/release index e6940fd82f..025f64e707 100644 --- a/bigbluebutton-html5/.meteor/release +++ b/bigbluebutton-html5/.meteor/release @@ -1 +1 @@ -METEOR@1.4.3.1 +METEOR@1.5 diff --git a/bigbluebutton-html5/.meteor/versions b/bigbluebutton-html5/.meteor/versions index 798c412921..934b30e0db 100644 --- a/bigbluebutton-html5/.meteor/versions +++ b/bigbluebutton-html5/.meteor/versions @@ -4,15 +4,15 @@ allow-deny@1.0.5 amplify@1.0.0 arunoda:npm@0.2.6 autoupdate@1.3.12 -babel-compiler@6.14.1 +babel-compiler@6.19.3 babel-runtime@1.0.1 base64@1.0.10 binary-heap@1.0.10 -blaze@2.3.0 +blaze@2.3.2 blaze-tools@1.0.10 -boilerplate-generator@1.0.11 +boilerplate-generator@1.1.1 caching-compiler@1.1.9 -caching-html-compiler@1.1.0 +caching-html-compiler@1.1.2 callback-hook@1.0.10 cfs:http-methods@0.0.32 cfs:micro-queue@0.0.6 @@ -21,22 +21,25 @@ cfs:reactive-list@0.0.9 cfs:reactive-property@0.0.4 check@1.2.5 clinical:nightwatch@2.0.1 -coffeescript@1.12.3_1 +coffeescript@1.12.6_1 ddp@1.2.5 -ddp-client@1.3.3 +ddp-client@1.3.4 ddp-common@1.2.8 -ddp-server@1.3.13 +ddp-server@1.3.14 deps@1.0.12 diff-sequence@1.0.7 -ecmascript@0.6.3 -ecmascript-runtime@0.3.15 +dynamic-import@0.1.1 +ecmascript@0.8.1 +ecmascript-runtime@0.4.1 +ecmascript-runtime-client@0.4.2 +ecmascript-runtime-server@0.4.1 ejson@1.0.13 fastclick@1.0.13 francocatena:status@1.5.3 geojson-utils@1.0.10 html-tools@1.0.11 htmljs@1.0.11 -http@1.2.11 +http@1.2.12 id-map@1.0.9 jquery@1.11.10 launch-screen@1.1.1 @@ -48,44 +51,44 @@ meteor-platform@1.2.6 meteorblackbelt:underscore-deep@0.0.4 meteorspark:util@0.2.0 minifier-css@1.2.16 -minifier-js@1.2.18 -minimongo@1.0.20 -mizzao:timesync@0.4.0 +minifier-js@2.1.0 +minimongo@1.2.1 +mizzao:timesync@0.5.0 mobile-status-bar@1.0.14 -modules@0.7.9 -modules-runtime@0.7.9 -mongo@1.1.15 +modules@0.9.2 +modules-runtime@0.8.0 +mongo@1.1.18 mongo-id@1.0.6 -nathantreid:css-modules@2.4.0 -npm-mongo@2.2.16_1 -observe-sequence@1.0.15 +nathantreid:css-modules@2.7.3 +npm-mongo@2.2.24 +observe-sequence@1.0.16 ordered-dict@1.0.9 -promise@0.8.8 +promise@0.8.9 raix:eventemitter@0.1.3 random@1.0.10 -react-meteor-data@0.2.11 -reactive-dict@1.1.8 +react-meteor-data@0.2.12 +reactive-dict@1.1.9 reactive-var@1.0.11 reload@1.1.11 retry@1.0.9 routepolicy@1.0.12 session@1.1.7 -shell-server@0.2.2 -spacebars@1.0.13 -spacebars-compiler@1.1.0 +shell-server@0.2.3 +spacebars@1.0.15 +spacebars-compiler@1.1.2 standard-app-packages@1.0.9 standard-minifier-css@1.3.4 -standard-minifier-js@1.2.3 +standard-minifier-js@2.1.0 tap:i18n@1.8.2 -templating@1.3.0 -templating-compiler@1.3.0 -templating-runtime@1.3.0 -templating-tools@1.1.0 +templating@1.3.2 +templating-compiler@1.3.2 +templating-runtime@1.3.2 +templating-tools@1.1.2 tmeasday:check-npm-versions@0.3.1 -tracker@1.1.2 +tracker@1.1.3 udondan:yml@3.2.2_1 -ui@1.0.12 +ui@1.0.13 underscore@1.0.10 url@1.1.0 -webapp@1.3.13 +webapp@1.3.16 webapp-hashing@1.0.9 From f0ce1c416fc4f7f549d09ef7a4b6f4b9cd08ee68 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Tue, 4 Jul 2017 17:17:56 -0400 Subject: [PATCH 10/28] change main app shell resize handler --- .../main/views/MainApplicationShell.mxml | 65 ++++++++++++++----- 1 file changed, 50 insertions(+), 15 deletions(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml index 8f9580638b..27bce1aad3 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml @@ -30,10 +30,10 @@ with BigBlueButton; if not, see . xmlns:maps="org.bigbluebutton.main.maps.*" xmlns:api="org.bigbluebutton.main.api.*" xmlns:common="org.bigbluebutton.common.*" - width="100%" height="{parentApplication.height - 1}" horizontalScrollPolicy="off" verticalScrollPolicy="off" backgroundColor="white" styleName="mainVBox" creationComplete="initializeShell()" + addedToStage="onAddedToStage()" verticalGap="0"> - - - - - - - From 70c7ebc1a1220d1fffcce575eea81f9369446983 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 7 Jul 2017 14:23:56 -0700 Subject: [PATCH 22/28] - continue removing old messages in akka-apps --- ...r.scala => ChangeUserRoleCmdMsgHdlr.scala} | 2 +- .../users/GetRecordingStatusReqMsgHdlr.scala | 30 ++++ .../users/LogoutAndEndMeetingCmdMsgHdlr.scala | 57 +++++++ .../MeetingActivityResponseCmdMsgHdlr.scala | 28 ++++ .../users/SetRecordingStatusCmdMsgHdlr.scala | 38 +++++ .../core/apps/users/UsersApp2x.scala | 8 +- .../core/apps/voice/VoiceApp2x.scala | 4 +- .../core/running/MeetingActor.scala | 152 +++++++----------- .../handlers/EndMeetingSysCmdMsgHdlr.scala | 50 ++++++ .../handlers/MuteMeetingCmdMsgHdlr.scala | 30 ++-- .../RecordingStartedVoiceConfEvtMsgHdlr.scala | 50 +++++- .../SendTimeRemainingUpdateHdlr.scala | 58 +++++++ .../common2/msgs/BreakoutMsgs.scala | 12 +- .../common2/msgs/SystemMsgs.scala | 12 +- .../bigbluebutton/common2/msgs/UsersMgs.scala | 59 +++++-- .../common2/msgs/VoiceConfMsgs.scala | 10 ++ 16 files changed, 468 insertions(+), 132 deletions(-) rename akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/{ChangeUserRoleHdlr.scala => ChangeUserRoleCmdMsgHdlr.scala} (94%) create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetRecordingStatusReqMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LogoutAndEndMeetingCmdMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/MeetingActivityResponseCmdMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SetRecordingStatusCmdMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/EndMeetingSysCmdMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/SendTimeRemainingUpdateHdlr.scala diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserRoleHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserRoleCmdMsgHdlr.scala similarity index 94% rename from akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserRoleHdlr.scala rename to akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserRoleCmdMsgHdlr.scala index 4f8ee391d8..af8c6d1ded 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserRoleHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ChangeUserRoleCmdMsgHdlr.scala @@ -3,7 +3,7 @@ package org.bigbluebutton.core.apps.users import org.bigbluebutton.common2.msgs._ import org.bigbluebutton.core.models.{ Roles, Users2x } -trait ChangeUserRoleHdlr { +trait ChangeUserRoleCmdMsgHdlr { this: UsersApp2x => def handleChangeUserRoleCmdMsg(msg: ChangeUserRoleCmdMsg) { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetRecordingStatusReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetRecordingStatusReqMsgHdlr.scala new file mode 100755 index 0000000000..583a7f70ad --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/GetRecordingStatusReqMsgHdlr.scala @@ -0,0 +1,30 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting } +import org.bigbluebutton.core2.MeetingStatus2x + +trait GetRecordingStatusReqMsgHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMessageGateway + + def handleGetRecordingStatusReqMsg(msg: GetRecordingStatusReqMsg) { + + def buildGetRecordingStatusRespMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId) + val envelope = BbbCoreEnvelope(GetRecordingStatusRespMsg.NAME, routing) + val body = GetRecordingStatusRespMsgBody(recording, userId) + val header = BbbClientMsgHeader(GetRecordingStatusRespMsg.NAME, meetingId, userId) + val event = GetRecordingStatusRespMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildGetRecordingStatusRespMsg(liveMeeting.props.meetingProp.intId, msg.body.requestedBy, + MeetingStatus2x.isRecording(liveMeeting.status)) + outGW.send(event) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LogoutAndEndMeetingCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LogoutAndEndMeetingCmdMsgHdlr.scala new file mode 100755 index 0000000000..b3d37e6783 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/LogoutAndEndMeetingCmdMsgHdlr.scala @@ -0,0 +1,57 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.api.{ EndMeeting, LogoutEndMeeting } +import org.bigbluebutton.core.models.{ Roles, Users2x } +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting } +import org.bigbluebutton.core2.MeetingStatus2x + +trait LogoutAndEndMeetingCmdMsgHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMessageGateway + + def handleLogoutAndEndMeetingCmdMsg(msg: LogoutAndEndMeetingCmdMsg) { + for { + u <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) + } yield { + if (u.role == Roles.MODERATOR_ROLE) { + endMeeting() + } + } + + def endMeeting(): Unit = { + def buildMeetingEndingEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used") + val envelope = BbbCoreEnvelope(MeetingEndingEvtMsg.NAME, routing) + val body = MeetingEndingEvtMsgBody(meetingId) + val header = BbbClientMsgHeader(MeetingEndingEvtMsg.NAME, meetingId, "not-used") + val event = MeetingEndingEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val endingEvent = buildMeetingEndingEvtMsg(liveMeeting.props.meetingProp.intId) + + // Broadcast users the meeting will end + outGW.send(endingEvent) + + MeetingStatus2x.meetingHasEnded(liveMeeting.status) + + def buildMeetingEndedEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = { + val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka") + val envelope = BbbCoreEnvelope(MeetingEndedEvtMsg.NAME, routing) + val body = MeetingEndedEvtMsgBody(meetingId) + val header = BbbCoreBaseHeader(MeetingEndedEvtMsg.NAME) + val event = MeetingEndedEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val endedEvnt = buildMeetingEndedEvtMsg(liveMeeting.props.meetingProp.intId) + outGW.send(endedEvnt) + } + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/MeetingActivityResponseCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/MeetingActivityResponseCmdMsgHdlr.scala new file mode 100755 index 0000000000..c493c26570 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/MeetingActivityResponseCmdMsgHdlr.scala @@ -0,0 +1,28 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting } + +trait MeetingActivityResponseCmdMsgHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMessageGateway + + def handleMeetingActivityResponseCmdMsg(msg: MeetingActivityResponseCmdMsg) { + def buildMeetingIsActiveEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used") + val envelope = BbbCoreEnvelope(MeetingIsActiveEvtMsg.NAME, routing) + val body = MeetingIsActiveEvtMsgBody(meetingId) + val header = BbbClientMsgHeader(MeetingIsActiveEvtMsg.NAME, meetingId, "not-used") + val event = MeetingIsActiveEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + log.info("User endorsed that meeting {} is active", liveMeeting.props.meetingProp.intId) + val event = buildMeetingIsActiveEvtMsg(liveMeeting.props.meetingProp.intId) + outGW.send(event) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SetRecordingStatusCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SetRecordingStatusCmdMsgHdlr.scala new file mode 100755 index 0000000000..b366ef4435 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/SetRecordingStatusCmdMsgHdlr.scala @@ -0,0 +1,38 @@ +package org.bigbluebutton.core.apps.users + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting } +import org.bigbluebutton.core2.MeetingStatus2x + +trait SetRecordingStatusCmdMsgHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMessageGateway + + def handleSetRecordingStatusCmdMsg(msg: SetRecordingStatusCmdMsg) { + log.info("Change recording status. meetingId=" + liveMeeting.props.meetingProp.intId + " recording=" + msg.body.recording) + if (liveMeeting.props.recordProp.allowStartStopRecording && + MeetingStatus2x.isRecording(liveMeeting.status) != msg.body.recording) { + if (msg.body.recording) { + MeetingStatus2x.recordingStarted(liveMeeting.status) + } else { + MeetingStatus2x.recordingStopped(liveMeeting.status) + } + + val event = buildRecordingStatusChangedEvtMsg(liveMeeting.props.meetingProp.intId, msg.body.setBy, msg.body.recording) + outGW.send(event) + } + + def buildRecordingStatusChangedEvtMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId) + val envelope = BbbCoreEnvelope(RecordingStatusChangedEvtMsg.NAME, routing) + val body = RecordingStatusChangedEvtMsgBody(recording, userId) + val header = BbbClientMsgHeader(RecordingStatusChangedEvtMsg.NAME, meetingId, userId) + val event = RecordingStatusChangedEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala index dba38d0136..ac24cc31fc 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala @@ -5,11 +5,15 @@ import org.bigbluebutton.core2.message.handlers.users.ValidateAuthTokenReqMsgHdl trait UsersApp2x extends RegisterUserReqMsgHdlr - with ChangeUserRoleHdlr + with ChangeUserRoleCmdMsgHdlr with SyncGetUsersMeetingRespMsgHdlr with EjectUserFromMeetingHdlr with ValidateAuthTokenReqMsgHdlr - with UserLeaveReqMsgHdlr { + with UserLeaveReqMsgHdlr + with LogoutAndEndMeetingCmdMsgHdlr + with MeetingActivityResponseCmdMsgHdlr + with SetRecordingStatusCmdMsgHdlr + with GetRecordingStatusReqMsgHdlr { this: MeetingActor => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala index 49471d8881..15aff65510 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp2x.scala @@ -1,12 +1,14 @@ package org.bigbluebutton.core.apps.voice import org.bigbluebutton.core.running.MeetingActor +import org.bigbluebutton.core2.message.handlers.RecordingStartedVoiceConfEvtMsgHdlr trait VoiceApp2x extends UserJoinedVoiceConfEvtMsgHdlr with UserJoinedVoiceConfMessageHdlr with UserLeftVoiceConfEvtMsgHdlr with UserMutedInVoiceConfEvtMsgHdlr - with UserTalkingInVoiceConfEvtMsgHdlr { + with UserTalkingInVoiceConfEvtMsgHdlr + with RecordingStartedVoiceConfEvtMsgHdlr { this: MeetingActor => } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index 241359d64b..4379f4b8b7 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -62,7 +62,8 @@ class MeetingActor(val props: DefaultProps, with IsMeetingMutedReqMsgHdlr with MuteUserCmdMsgHdlr with EjectUserFromVoiceCmdMsgHdlr - + with EndMeetingSysCmdMsgHdlr + with SendTimeRemainingUpdateHdlr with SyncGetMeetingInfoRespMsgHdlr { override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) { @@ -108,9 +109,7 @@ class MeetingActor(val props: DefaultProps, //======================================= // old messages - case msg: ActivityResponse => handleActivityResponse(msg) case msg: MonitorNumberOfUsers => handleMonitorNumberOfUsers(msg) - case msg: VoiceConfRecordingStartedMessage => handleVoiceConfRecordingStartedMessage(msg) case msg: AllowUserToShareDesktop => handleAllowUserToShareDesktop(msg) @@ -120,14 +119,11 @@ class MeetingActor(val props: DefaultProps, case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg) case msg: InitializeMeeting => handleInitializeMeeting(msg) - case msg: SetRecordingStatus => handleSetRecordingStatus(msg) - case msg: GetRecordingStatus => handleGetRecordingStatus(msg) - case msg: LogoutEndMeeting => handleLogoutEndMeeting(msg) + case msg: ClearPublicChatHistoryRequest => handleClearPublicChatHistoryRequest(msg) case msg: ExtendMeetingDuration => handleExtendMeetingDuration(msg) case msg: SendTimeRemainingUpdate => handleSendTimeRemainingUpdate(msg) - case msg: EndMeeting => handleEndMeeting(msg) case msg: DeskShareStartedRequest => handleDeskShareStartedRequest(msg) case msg: DeskShareStoppedRequest => handleDeskShareStoppedRequest(msg) @@ -153,6 +149,10 @@ class MeetingActor(val props: DefaultProps, case m: UserBroadcastCamStartMsg => handleUserBroadcastCamStartMsg(m) case m: UserBroadcastCamStopMsg => handleUserBroadcastCamStopMsg(m) case m: UserJoinedVoiceConfEvtMsg => handleUserJoinedVoiceConfEvtMsg(m) + case m: MeetingActivityResponseCmdMsg => handleMeetingActivityResponseCmdMsg(m) + case m: LogoutAndEndMeetingCmdMsg => handleLogoutAndEndMeetingCmdMsg(m) + case m: SetRecordingStatusCmdMsg => handleSetRecordingStatusCmdMsg(m) + case m: GetRecordingStatusReqMsg => handleGetRecordingStatusReqMsg(m) // Whiteboard case m: SendCursorPositionPubMsg => handleSendCursorPositionPubMsg(m) @@ -174,7 +174,7 @@ class MeetingActor(val props: DefaultProps, // Breakout case m: BreakoutRoomsListMsg => handleBreakoutRoomsListMsg(m) - case m: CreateBreakoutRoomSysCmdMsg => handleCreateBreakoutRoomsCmdMsg(m) + case m: CreateBreakoutRoomsCmdMsg => handleCreateBreakoutRoomsCmdMsg(m) case m: EndAllBreakoutRoomsMsg => handleEndAllBreakoutRoomsMsg(m) case m: RequestBreakoutJoinURLReqMsg => handleRequestBreakoutJoinURLReqMsg(m) case m: BreakoutRoomCreatedMsg => handleBreakoutRoomCreatedMsg(m) @@ -187,6 +187,7 @@ class MeetingActor(val props: DefaultProps, case m: UserLeftVoiceConfEvtMsg => handleUserLeftVoiceConfEvtMsg(m) case m: UserMutedInVoiceConfEvtMsg => handleUserMutedInVoiceConfEvtMsg(m) case m: UserTalkingInVoiceConfEvtMsg => handleUserTalkingInVoiceConfEvtMsg(m) + case m: RecordingStartedVoiceConfEvtMsg => handleRecordingStartedVoiceConfEvtMsg(m) // Layout case m: GetCurrentLayoutReqMsg => handleGetCurrentLayoutReqMsg(m) @@ -287,66 +288,16 @@ class MeetingActor(val props: DefaultProps, // MeetingStatus2x.getGuestPolicy(liveMeeting.status).toString())) } - def handleLogoutEndMeeting(msg: LogoutEndMeeting) { - for { - u <- Users2x.findWithIntId(liveMeeting.users2x, msg.userID) - } yield { - if (u.role == Roles.MODERATOR_ROLE) { - handleEndMeeting(EndMeeting(props.meetingProp.intId)) - } - } - } - - def handleActivityResponse(msg: ActivityResponse) { - log.info("User endorsed that meeting {} is active", props.meetingProp.intId) - outGW.send(new MeetingIsActive(props.meetingProp.intId)) - } - - def handleEndMeeting(msg: EndMeeting) { - // Broadcast users the meeting will end - outGW.send(new MeetingEnding(msg.meetingId)) - - MeetingStatus2x.meetingHasEnded(liveMeeting.status) - - outGW.send(new MeetingEnded(msg.meetingId, props.recordProp.record, props.meetingProp.intId)) - } - def handleAllowUserToShareDesktop(msg: AllowUserToShareDesktop): Unit = { Users2x.findPresenter(liveMeeting.users2x) match { case Some(curPres) => { val allowed = msg.userID equals (curPres.intId) - outGW.send(AllowUserToShareDesktopOut(msg.meetingID, msg.userID, allowed)) + // outGW.send(AllowUserToShareDesktopOut(msg.meetingID, msg.userID, allowed)) } case None => // do nothing } } - def handleVoiceConfRecordingStartedMessage(msg: VoiceConfRecordingStartedMessage) { - if (msg.recording) { - MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, msg.recordStream) - outGW.send(new VoiceRecordingStarted(props.meetingProp.intId, props.recordProp.record, - msg.recordStream, msg.timestamp, props.voiceProp.voiceConf)) - } else { - MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, "") - outGW.send(new VoiceRecordingStopped(props.meetingProp.intId, props.recordProp.record, - msg.recordStream, msg.timestamp, props.voiceProp.voiceConf)) - } - } - - def handleSetRecordingStatus(msg: SetRecordingStatus) { - log.info("Change recording status. meetingId=" + props.meetingProp.intId + " recording=" + msg.recording) - if (props.recordProp.allowStartStopRecording && - MeetingStatus2x.isRecording(liveMeeting.status) != msg.recording) { - if (msg.recording) { - MeetingStatus2x.recordingStarted(liveMeeting.status) - } else { - MeetingStatus2x.recordingStopped(liveMeeting.status) - } - - outGW.send(new RecordingStatusChanged(props.meetingProp.intId, props.recordProp.record, msg.userId, msg.recording)) - } - } - // WebRTC Desktop Sharing def handleDeskShareStartedRequest(msg: DeskShareStartedRequest): Unit = { @@ -359,7 +310,7 @@ class MeetingActor(val props: DefaultProps, log.info("handleDeskShareStartedRequest: streamPath=" + streamPath) // Tell FreeSwitch to broadcast to RTMP - outGW.send(new DeskShareStartRTMPBroadcast(msg.conferenceName, streamPath)) + //outGW.send(new DeskShareStartRTMPBroadcast(msg.conferenceName, streamPath)) DeskshareModel.setDeskShareStarted(liveMeeting.deskshareModel, true) } @@ -371,8 +322,8 @@ class MeetingActor(val props: DefaultProps, " URL:" + DeskshareModel.getRTMPBroadcastingUrl(liveMeeting.deskshareModel)) // Tell FreeSwitch to stop broadcasting to RTMP - outGW.send(new DeskShareStopRTMPBroadcast(msg.conferenceName, - DeskshareModel.getRTMPBroadcastingUrl(liveMeeting.deskshareModel))) + //outGW.send(new DeskShareStopRTMPBroadcast(msg.conferenceName, + // DeskshareModel.getRTMPBroadcastingUrl(liveMeeting.deskshareModel))) DeskshareModel.setDeskShareStarted(liveMeeting.deskshareModel, false) } @@ -391,7 +342,7 @@ class MeetingActor(val props: DefaultProps, log.info("START broadcast ALLOWED when isBroadcastingRTMP=false") // Notify viewers in the meeting that there's an rtmp stream to view - outGW.send(new DeskShareNotifyViewersRTMP(props.meetingProp.intId, msg.streamname, msg.videoWidth, msg.videoHeight, true)) + //outGW.send(new DeskShareNotifyViewersRTMP(props.meetingProp.intId, msg.streamname, msg.videoWidth, msg.videoHeight, true)) } else { log.info("START broadcast NOT ALLOWED when isBroadcastingRTMP=true") } @@ -403,11 +354,23 @@ class MeetingActor(val props: DefaultProps, } def monitorNumberOfWebUsers() { + + def buildEjectAllFromVoiceConfMsg(meetingId: String, voiceConf: String): BbbCommonEnvCoreMsg = { + val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka") + val envelope = BbbCoreEnvelope(EjectAllFromVoiceConfMsg.NAME, routing) + val body = EjectAllFromVoiceConfMsgBody(voiceConf) + val header = BbbCoreHeaderWithMeetingId(EjectAllFromVoiceConfMsg.NAME, meetingId) + val event = EjectAllFromVoiceConfMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + if (Users2x.numUsers(liveMeeting.users2x) == 0 && MeetingStatus2x.lastWebUserLeftOn(liveMeeting.status) > 0) { if (liveMeeting.timeNowInMinutes - MeetingStatus2x.lastWebUserLeftOn(liveMeeting.status) > 2) { log.info("Empty meeting. Ejecting all users from voice. meetingId={}", props.meetingProp.intId) - outGW.send(new EjectAllVoiceUsers(props.meetingProp.intId, props.recordProp.record, props.voiceProp.voiceConf)) + val event = buildEjectAllFromVoiceConfMsg(props.meetingProp.intId, props.voiceProp.voiceConf) + outGW.send(event) } } } @@ -418,39 +381,30 @@ class MeetingActor(val props: DefaultProps, eventBus.publish(BigBlueButtonEvent(props.meetingProp.intId, UpdateMeetingExpireMonitor(props.meetingProp.intId, hasUsers))) } - def handleSendTimeRemainingUpdate(msg: SendTimeRemainingUpdate) { - if (props.durationProps.duration > 0) { - val endMeetingTime = MeetingStatus2x.startedOn(liveMeeting.status) + (props.durationProps.duration * 60) - val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds - outGW.send(new MeetingTimeRemainingUpdate(props.meetingProp.intId, props.recordProp.record, timeRemaining.toInt)) - } - if (!props.meetingProp.isBreakout && !BreakoutRooms.getRooms(liveMeeting.breakoutRooms).isEmpty) { - val endMeetingTime = BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) + - (BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms) * 60) - val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds - outGW.send(new BreakoutRoomsTimeRemainingUpdateOutMessage(props.meetingProp.intId, props.recordProp.record, timeRemaining.toInt)) - } else if (BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) != 0) { - BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms, 0) - BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms, 0) - } - } - def handleExtendMeetingDuration(msg: ExtendMeetingDuration) { } - def handleGetRecordingStatus(msg: GetRecordingStatus) { - outGW.send(new GetRecordingStatusReply(props.meetingProp.intId, props.recordProp.record, - msg.userId, MeetingStatus2x.isRecording(liveMeeting.status).booleanValue())) - } - def startRecordingIfAutoStart() { if (props.recordProp.record && !MeetingStatus2x.isRecording(liveMeeting.status) && props.recordProp.autoStartRecording && Users2x.numUsers(liveMeeting.users2x) == 1) { log.info("Auto start recording. meetingId={}", props.meetingProp.intId) MeetingStatus2x.recordingStarted(liveMeeting.status) - outGW.send(new RecordingStatusChanged(props.meetingProp.intId, props.recordProp.record, - "system", MeetingStatus2x.isRecording(liveMeeting.status))) + + def buildRecordingStatusChangedEvtMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId) + val envelope = BbbCoreEnvelope(RecordingStatusChangedEvtMsg.NAME, routing) + val body = RecordingStatusChangedEvtMsgBody(recording, userId) + val header = BbbClientMsgHeader(RecordingStatusChangedEvtMsg.NAME, meetingId, userId) + val event = RecordingStatusChangedEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildRecordingStatusChangedEvtMsg(liveMeeting.props.meetingProp.intId, + "system", MeetingStatus2x.isRecording(liveMeeting.status)) + outGW.send(event) + } } @@ -459,14 +413,22 @@ class MeetingActor(val props: DefaultProps, props.recordProp.autoStartRecording && Users2x.numUsers(liveMeeting.users2x) == 0) { log.info("Last web user left. Auto stopping recording. meetingId={}", props.meetingProp.intId) MeetingStatus2x.recordingStopped(liveMeeting.status) - outGW.send(new RecordingStatusChanged(props.meetingProp.intId, props.recordProp.record, - "system", MeetingStatus2x.isRecording(liveMeeting.status))) - } - } - def sendMeetingHasEnded(userId: String) { - outGW.send(new MeetingHasEnded(props.meetingProp.intId, userId)) - outGW.send(new DisconnectUser(props.meetingProp.intId, userId)) + def buildRecordingStatusChangedEvtMsg(meetingId: String, userId: String, recording: Boolean): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId) + val envelope = BbbCoreEnvelope(RecordingStatusChangedEvtMsg.NAME, routing) + val body = RecordingStatusChangedEvtMsgBody(recording, userId) + val header = BbbClientMsgHeader(RecordingStatusChangedEvtMsg.NAME, meetingId, userId) + val event = RecordingStatusChangedEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildRecordingStatusChangedEvtMsg(liveMeeting.props.meetingProp.intId, + "system", MeetingStatus2x.isRecording(liveMeeting.status)) + outGW.send(event) + + } } def record(msg: BbbCoreMsg): Unit = { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/EndMeetingSysCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/EndMeetingSysCmdMsgHdlr.scala new file mode 100755 index 0000000000..f01e51dee9 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/EndMeetingSysCmdMsgHdlr.scala @@ -0,0 +1,50 @@ +package org.bigbluebutton.core2.message.handlers + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting } +import org.bigbluebutton.core2.MeetingStatus2x + +trait EndMeetingSysCmdMsgHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMessageGateway + + def handleEndMeeting(msg: EndMeetingSysCmdMsg) { + endMeeting() + + def endMeeting(): Unit = { + def buildMeetingEndingEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used") + val envelope = BbbCoreEnvelope(MeetingEndingEvtMsg.NAME, routing) + val body = MeetingEndingEvtMsgBody(meetingId) + val header = BbbClientMsgHeader(MeetingEndingEvtMsg.NAME, meetingId, "not-used") + val event = MeetingEndingEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val endingEvent = buildMeetingEndingEvtMsg(liveMeeting.props.meetingProp.intId) + + // Broadcast users the meeting will end + outGW.send(endingEvent) + + MeetingStatus2x.meetingHasEnded(liveMeeting.status) + + def buildMeetingEndedEvtMsg(meetingId: String): BbbCommonEnvCoreMsg = { + val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka") + val envelope = BbbCoreEnvelope(MeetingEndedEvtMsg.NAME, routing) + val body = MeetingEndedEvtMsgBody(meetingId) + val header = BbbCoreBaseHeader(MeetingEndedEvtMsg.NAME) + val event = MeetingEndedEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val endedEvnt = buildMeetingEndedEvtMsg(liveMeeting.props.meetingProp.intId) + outGW.send(endedEvnt) + } + } + +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/MuteMeetingCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/MuteMeetingCmdMsgHdlr.scala index 964a53e941..b146416c4a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/MuteMeetingCmdMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/MuteMeetingCmdMsgHdlr.scala @@ -13,21 +13,6 @@ trait MuteMeetingCmdMsgHdlr { def handleMuteMeetingCmdMsg(msg: MuteMeetingCmdMsg) { - if (MeetingStatus2x.isMeetingMuted(liveMeeting.status)) { - MeetingStatus2x.unmuteMeeting(liveMeeting.status) - } else { - MeetingStatus2x.muteMeeting(liveMeeting.status) - } - - val muted = MeetingStatus2x.isMeetingMuted(liveMeeting.status) - val event = build(props.meetingProp.intId, msg.body.mutedBy, muted, msg.body.mutedBy) - - outGW.send(event) - - VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { u => - muteUserInVoiceConf(u) - } - def build(meetingId: String, userId: String, muted: Boolean, mutedBy: String): BbbCommonEnvCoreMsg = { val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId) val envelope = BbbCoreEnvelope(MeetingMutedEvtMsg.NAME, routing) @@ -52,6 +37,21 @@ trait MuteMeetingCmdMsgHdlr { } + if (MeetingStatus2x.isMeetingMuted(liveMeeting.status)) { + MeetingStatus2x.unmuteMeeting(liveMeeting.status) + } else { + MeetingStatus2x.muteMeeting(liveMeeting.status) + } + + val muted = MeetingStatus2x.isMeetingMuted(liveMeeting.status) + val meetingMutedEvent = build(props.meetingProp.intId, msg.body.mutedBy, muted, msg.body.mutedBy) + + outGW.send(meetingMutedEvent) + + VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { u => + muteUserInVoiceConf(u) + } + VoiceUsers.findAll(liveMeeting.voiceUsers) foreach { vu => if (!vu.listenOnly) { muteUserInVoiceConf(vu) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/RecordingStartedVoiceConfEvtMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/RecordingStartedVoiceConfEvtMsgHdlr.scala index aa085aa020..ef98c7917c 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/RecordingStartedVoiceConfEvtMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/RecordingStartedVoiceConfEvtMsgHdlr.scala @@ -1,8 +1,52 @@ package org.bigbluebutton.core2.message.handlers -/** - * Created by ritz on 2017-06-09. - */ +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting } +import org.bigbluebutton.core2.MeetingStatus2x + trait RecordingStartedVoiceConfEvtMsgHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMessageGateway + + def handleRecordingStartedVoiceConfEvtMsg(msg: RecordingStartedVoiceConfEvtMsg) { + if (msg.body.recording) { + MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, msg.body.stream) + + def buildVoiceRecordingStartedEvtMsg(meetingId: String, stream: String, timestamp: String, voiceConf: String): BbbCommonEnvCoreMsg = { + val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka") + val envelope = BbbCoreEnvelope(VoiceRecordingStartedEvtMsg.NAME, routing) + + val body = VoiceRecordingStartedEvtMsgBody(meetingId, stream, timestamp, voiceConf) + val header = BbbCoreVoiceConfHeader(VoiceRecordingStartedEvtMsg.NAME, meetingId) + val event = VoiceRecordingStartedEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildVoiceRecordingStartedEvtMsg(liveMeeting.props.meetingProp.intId, msg.body.stream, + msg.body.timestamp, liveMeeting.props.voiceProp.voiceConf) + outGW.send(event) + } else { + MeetingStatus2x.setVoiceRecordingFilename(liveMeeting.status, "") + + def buildVoiceRecordingStoppedEvtMsg(meetingId: String, stream: String, timestamp: String, voiceConf: String): BbbCommonEnvCoreMsg = { + val routing = collection.immutable.HashMap("sender" -> "bbb-apps-akka") + val envelope = BbbCoreEnvelope(VoiceRecordingStoppedEvtMsg.NAME, routing) + + val body = VoiceRecordingStoppedEvtMsgBody(meetingId, stream, timestamp, voiceConf) + val header = BbbCoreVoiceConfHeader(VoiceRecordingStoppedEvtMsg.NAME, meetingId) + val event = VoiceRecordingStoppedEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildVoiceRecordingStoppedEvtMsg(liveMeeting.props.meetingProp.intId, msg.body.stream, + msg.body.timestamp, liveMeeting.props.voiceProp.voiceConf) + outGW.send(event) + } + } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/SendTimeRemainingUpdateHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/SendTimeRemainingUpdateHdlr.scala new file mode 100755 index 0000000000..e55c46571b --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/SendTimeRemainingUpdateHdlr.scala @@ -0,0 +1,58 @@ +package org.bigbluebutton.core2.message.handlers + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.api.{ BreakoutRoomsTimeRemainingUpdateOutMessage, MeetingTimeRemainingUpdate, SendTimeRemainingUpdate } +import org.bigbluebutton.core.models.BreakoutRooms +import org.bigbluebutton.core.running.{ BaseMeetingActor, LiveMeeting } +import org.bigbluebutton.core2.MeetingStatus2x + +trait SendTimeRemainingUpdateHdlr { + this: BaseMeetingActor => + + val liveMeeting: LiveMeeting + val outGW: OutMessageGateway + + def handleSendTimeRemainingUpdate(msg: SendTimeRemainingUpdate) { + if (liveMeeting.props.durationProps.duration > 0) { + val endMeetingTime = MeetingStatus2x.startedOn(liveMeeting.status) + (liveMeeting.props.durationProps.duration * 60) + val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds + + def buildMeetingTimeRemainingUpdateEvtMsg(meetingId: String, timeLeftInSec: Long): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used") + val envelope = BbbCoreEnvelope(MeetingTimeRemainingUpdateEvtMsg.NAME, routing) + val body = MeetingTimeRemainingUpdateEvtMsgBody(timeLeftInSec) + val header = BbbClientMsgHeader(MeetingTimeRemainingUpdateEvtMsg.NAME, meetingId, "not-used") + val event = MeetingTimeRemainingUpdateEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildMeetingTimeRemainingUpdateEvtMsg(liveMeeting.props.meetingProp.intId, timeRemaining.toInt) + outGW.send(event) + } + if (!liveMeeting.props.meetingProp.isBreakout && !BreakoutRooms.getRooms(liveMeeting.breakoutRooms).isEmpty) { + val endMeetingTime = BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) + + (BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms) * 60) + val timeRemaining = endMeetingTime - liveMeeting.timeNowInSeconds + + def buildBreakoutRoomsTimeRemainingUpdateEvtMsg(meetingId: String, timeLeftInSec: Long): BbbCommonEnvCoreMsg = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, "not-used") + val envelope = BbbCoreEnvelope(BreakoutRoomsTimeRemainingUpdateEvtMsg.NAME, routing) + val body = BreakoutRoomsTimeRemainingUpdateEvtMsgBody(timeLeftInSec) + val header = BbbClientMsgHeader(BreakoutRoomsTimeRemainingUpdateEvtMsg.NAME, meetingId, "not-used") + val event = BreakoutRoomsTimeRemainingUpdateEvtMsg(header, body) + + BbbCommonEnvCoreMsg(envelope, event) + } + + val event = buildBreakoutRoomsTimeRemainingUpdateEvtMsg(liveMeeting.props.meetingProp.intId, timeRemaining.toInt) + + outGW.send(event) + } else if (BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms) != 0) { + BreakoutRooms.breakoutRoomsdurationInMinutes(liveMeeting.breakoutRooms, 0) + BreakoutRooms.breakoutRoomsStartedOn(liveMeeting.breakoutRooms, 0) + } + } + +} diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala index ff4e26c6e8..3f2d08695f 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala @@ -38,7 +38,7 @@ package org.bigbluebutton.common2.msgs object BreakoutRoomsTimeRemainingUpdateEvtMsg { val NAME = "BreakoutRoomsTimeRemainingUpdateEvtMsg" } case class BreakoutRoomsTimeRemainingUpdateEvtMsg(header: BbbClientMsgHeader, body: BreakoutRoomsTimeRemainingUpdateEvtMsgBody) extends BbbCoreMsg - case class BreakoutRoomsTimeRemainingUpdateEvtMsgBody(meetingId: String, timeRemaining: Int) + case class BreakoutRoomsTimeRemainingUpdateEvtMsgBody(timeRemaining: Long) // Sent by breakout actor to tell meeting actor the list of users in the breakout room. @@ -46,6 +46,9 @@ package org.bigbluebutton.common2.msgs case class BreakoutRoomUsersUpdateMsg(header: BbbClientMsgHeader, body: BreakoutRoomUsersUpdateMsgBody) extends BbbCoreMsg case class BreakoutRoomUsersUpdateMsgBody(meetingId: String, breakoutMeetingId: String, users: Vector[BreakoutUserVO]) +/** + * Sent to bbb-web to create breakout rooms. + */ object CreateBreakoutRoomSysCmdMsg { val NAME = "CreateBreakoutRoomSysCmdMsg" } case class CreateBreakoutRoomSysCmdMsg(header: BbbCoreBaseHeader, body: CreateBreakoutRoomSysCmdMsgBody) extends BbbCoreMsg @@ -54,6 +57,9 @@ package org.bigbluebutton.common2.msgs voiceConfId: String, durationInMinutes: Int, moderatorPassword: String, viewerPassword: String, sourcePresentationId: String, sourcePresentationSlide: Int, record: Boolean) +/** + * Sent by client to request to create breakout rooms. + */ object CreateBreakoutRoomsCmdMsg { val NAME = "CreateBreakoutRoomsCmdMsg" } case class CreateBreakoutRoomsCmdMsg(header: BbbClientMsgHeader, body: CreateBreakoutRoomsCmdMsgBody) extends BbbCoreMsg case class CreateBreakoutRoomsCmdMsgBody(meetingId: String, durationInMinutes: Int, record: Boolean, rooms: Vector[BreakoutRoomMsgBody]) @@ -68,10 +74,6 @@ package org.bigbluebutton.common2.msgs case class EndBreakoutRoomEvtMsg(header: BbbClientMsgHeader, body: EndBreakoutRoomEvtMsgBody) extends BbbCoreMsg case class EndBreakoutRoomEvtMsgBody(breakoutMeetingId: String) - object MeetingTimeRemainingUpdateEvtMsg { val NAME = "MeetingTimeRemainingUpdateEvtMsg" } - case class MeetingTimeRemainingUpdateEvtMsg(header: BbbClientMsgHeader, body: MeetingTimeRemainingUpdateEvtMsgBody) extends BbbCoreMsg - case class MeetingTimeRemainingUpdateEvtMsgBody(meetingId: String, timeRemaining: Int) - /** * Sent by client to request a join URL for the breakout room. */ diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala index aed7a0dcf9..9f08e67318 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/SystemMsgs.scala @@ -14,7 +14,7 @@ import org.bigbluebutton.common2.domain.DefaultProps body: DestroyMeetingSysCmdMsgBody) extends BbbCoreMsg case class DestroyMeetingSysCmdMsgBody(meetingId: String) - object EndMeetingSysCmdMsg { val NAME = "DestroyMeetingReqMsg" } + object EndMeetingSysCmdMsg { val NAME = "EndMeetingSysCmdMsg" } case class EndMeetingSysCmdMsg(header: BbbCoreBaseHeader, body: EndMeetingSysCmdMsgBody) extends BbbCoreMsg case class EndMeetingSysCmdMsgBody(meetingId: String) @@ -40,6 +40,11 @@ import org.bigbluebutton.common2.domain.DefaultProps body: MeetingEndedEvtMsgBody) extends BbbCoreMsg case class MeetingEndedEvtMsgBody(meetingId: String) +object MeetingEndingEvtMsg { val NAME = "MeetingEndingEvtMsg"} +case class MeetingEndingEvtMsg(header: BbbClientMsgHeader, + body: MeetingEndingEvtMsgBody) extends BbbCoreMsg +case class MeetingEndingEvtMsgBody(meetingId: String) + object MeetingDestroyedEvtMsg { val NAME = "MeetingDestroyedEvtMsg"} case class MeetingDestroyedEvtMsg(header: BbbCoreBaseHeader, body: MeetingDestroyedEvtMsgBody) extends BbbCoreMsg @@ -68,6 +73,10 @@ object SyncGetMeetingInfoRespMsg { val NAME = "SyncGetMeetingInfoRespMsg"} /** System Messages **/ +object MeetingTimeRemainingUpdateEvtMsg { val NAME = "MeetingTimeRemainingUpdateEvtMsg" } +case class MeetingTimeRemainingUpdateEvtMsg(header: BbbClientMsgHeader, + body: MeetingTimeRemainingUpdateEvtMsgBody) extends BbbCoreMsg +case class MeetingTimeRemainingUpdateEvtMsgBody(timeLeftInSec: Long) object MeetingInactivityWarningEvtMsg { val NAME = "MeetingInactivityWarningEvtMsg" } case class MeetingInactivityWarningEvtMsg(header: BbbClientMsgHeader, @@ -79,6 +88,7 @@ case class MeetingIsActiveEvtMsg(header: BbbClientMsgHeader, body: MeetingIsActiveEvtMsgBody) extends BbbCoreMsg case class MeetingIsActiveEvtMsgBody(meetingId: String) + case class AkkaAppsCheckAliveReqBody(timestamp: Long) case class AkkaAppsCheckAliveReqMsg(header: BbbCoreHeader, body: AkkaAppsCheckAliveReqBody) case class AkkaAppsCheckAliveReq(envelope: BbbCoreEnvelope, msg: AkkaAppsCheckAliveReqMsg) extends BbbCoreMsg diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala index 08e0f22b95..3829c3a1d1 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala @@ -67,23 +67,57 @@ case class UserJoinedMeetingEvtMsgBody(intId: String, extId: String, name: Strin guest: Boolean, authed: Boolean, waitingForAcceptance: Boolean, emoji: String, presenter: Boolean, locked: Boolean, avatar: String) -object GetUsersReqMsg { - val NAME = "GetUsersReqMsg" -} - +/** + * Sent by client to get all users in a meeting. + */ +object GetUsersReqMsg { val NAME = "GetUsersReqMsg" } case class GetUsersReqMsg(header: BbbClientMsgHeader, body: GetUsersReqMsgBody) extends BbbCoreMsg - case class GetUsersReqMsgBody(requesterId: String) +/** + * Sent by user to get status of recording mark. + */ +object GetRecordingStatusReqMsg { val NAME = "GetRecordingStatusReqMsg" } +case class GetRecordingStatusReqMsg(header: BbbClientMsgHeader, body: GetRecordingStatusReqMsgBody) extends BbbCoreMsg +case class GetRecordingStatusReqMsgBody(requestedBy: String) -object UserEmojiChangedEvtMsg { - val NAME = "UserEmojiChangedEvtMsg" -} +/** + * Sent by user as response to get recording mark. + */ +object GetRecordingStatusRespMsg { val NAME = "GetRecordingStatusRespMsg" } +case class GetRecordingStatusRespMsg(header: BbbClientMsgHeader, body: GetRecordingStatusRespMsgBody) extends BbbCoreMsg +case class GetRecordingStatusRespMsgBody(recording: Boolean, requestedBy: String) + + +/** + * Sent by user to start recording mark. + */ +object SetRecordingStatusCmdMsg { val NAME = "SetRecordingStatusCmdMsg" } +case class SetRecordingStatusCmdMsg(header: BbbClientMsgHeader, body: SetRecordingStatusCmdMsgBody) extends BbbCoreMsg +case class SetRecordingStatusCmdMsgBody(recording: Boolean, setBy: String) + +/** + * Sent to all users about start recording mark. + */ +object RecordingStatusChangedEvtMsg { val NAME = "RecordingStatusChangedEvtMsg" } +case class RecordingStatusChangedEvtMsg(header: BbbClientMsgHeader, body: RecordingStatusChangedEvtMsgBody) extends BbbCoreMsg +case class RecordingStatusChangedEvtMsgBody(recording: Boolean, setBy: String) + +/** + * Sent to all clients about a user changing emoji. + */ +object UserEmojiChangedEvtMsg { val NAME = "UserEmojiChangedEvtMsg" } case class UserEmojiChangedEvtMsg(header: BbbClientMsgHeader, body: UserEmojiChangedEvtMsgBody) extends BbbCoreMsg - case class UserEmojiChangedEvtMsgBody(userId: String, emoji: String) +/** + * Sent from client as a response to inactivity notifaction from server. + */ +object MeetingActivityResponseCmdMsg { val NAME = "MeetingActivityResponseCmdMsg" } +case class MeetingActivityResponseCmdMsg(header: BbbClientMsgHeader, body: MeetingActivityResponseCmdMsgBody) extends BbbCoreMsg +case class MeetingActivityResponseCmdMsgBody(respondedBy: String) + /** * Sent from client to change the rolr of the user the user in the meeting. */ @@ -109,6 +143,13 @@ object LockUserInMeetingCmdMsg { val NAME = "LockUserInMeetingCmdMsg" } case class LockUserInMeetingCmdMsg(header: BbbClientMsgHeader, body: LockUserInMeetingCmdMsgBody) extends BbbCoreMsg case class LockUserInMeetingCmdMsgBody(userId: String, lock: Boolean, lockedBy: String) +/** + * Sent from client to logout and end meeting. + */ +object LogoutAndEndMeetingCmdMsg { val NAME = "LogoutAndEndMeetingCmdMsg" } +case class LogoutAndEndMeetingCmdMsg(header: BbbClientMsgHeader, body: LogoutAndEndMeetingCmdMsgBody) extends BbbCoreMsg +case class LogoutAndEndMeetingCmdMsgBody(userId: String) + /** * Send to client that user has been locked. */ diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala index d94b912a54..8751b4f557 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala @@ -230,4 +230,14 @@ case class MeetingMutedEvtMsgBody(muted: Boolean, mutedBy: String) case class UserTalkingInVoiceConfEvtMsgBody(voiceConf: String, voiceUserId: String, talking: Boolean) +object VoiceRecordingStartedEvtMsg { val NAME = "VoiceRecordingStartedEvtMsg" } +case class VoiceRecordingStartedEvtMsg(header: BbbCoreVoiceConfHeader, + body: VoiceRecordingStartedEvtMsgBody) extends BbbCoreMsg +case class VoiceRecordingStartedEvtMsgBody(meetingId: String, stream: String, timestamp: String, voiceConf: String) + +object VoiceRecordingStoppedEvtMsg { val NAME = "VoiceRecordingStoppedEvtMsg" } +case class VoiceRecordingStoppedEvtMsg(header: BbbCoreVoiceConfHeader, + body: VoiceRecordingStoppedEvtMsgBody) extends BbbCoreMsg +case class VoiceRecordingStoppedEvtMsgBody(meetingId: String, stream: String, timestamp: String, voiceConf: String) + From 507cc699392a80f95c15ec4a0b3d2a3762169d72 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 7 Jul 2017 14:51:25 -0700 Subject: [PATCH 23/28] - fix compile issues --- .../freeswitch/RxJsonMsgDeserializer.scala | 30 +++++++++---------- .../freeswitch/RxJsonMsgHdlrActor.scala | 10 +++---- .../api2/bus/ReceivedJsonMsgHdlrActor.scala | 4 +-- .../api2/meeting/OldMeetingMsgHdlrActor.scala | 4 +-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgDeserializer.scala b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgDeserializer.scala index 869a62d2af..67d05e0357 100755 --- a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgDeserializer.scala +++ b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgDeserializer.scala @@ -28,10 +28,10 @@ trait RxJsonMsgDeserializer { } def routeEjectUserFromVoiceConfMsg(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = { - def deserialize(jsonNode: JsonNode): Option[EjectUserFromVoiceConfMsg] = { - val (result, error) = JsonDeserializer.toBbbCommonMsg[EjectUserFromVoiceConfMsg](jsonNode) + def deserialize(jsonNode: JsonNode): Option[EjectUserFromVoiceConfSysMsg] = { + val (result, error) = JsonDeserializer.toBbbCommonMsg[EjectUserFromVoiceConfSysMsg](jsonNode) result match { - case Some(msg) => Some(msg.asInstanceOf[EjectUserFromVoiceConfMsg]) + case Some(msg) => Some(msg.asInstanceOf[EjectUserFromVoiceConfSysMsg]) case None => log.error("Failed to deserialize message: error: {} \n msg: {}", error, jsonNode) None @@ -46,10 +46,10 @@ trait RxJsonMsgDeserializer { } def routeMuteUserInVoiceConfMsg(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = { - def deserialize(jsonNode: JsonNode): Option[MuteUserInVoiceConfMsg] = { - val (result, error) = JsonDeserializer.toBbbCommonMsg[MuteUserInVoiceConfMsg](jsonNode) + def deserialize(jsonNode: JsonNode): Option[MuteUserInVoiceConfSysMsg] = { + val (result, error) = JsonDeserializer.toBbbCommonMsg[MuteUserInVoiceConfSysMsg](jsonNode) result match { - case Some(msg) => Some(msg.asInstanceOf[MuteUserInVoiceConfMsg]) + case Some(msg) => Some(msg.asInstanceOf[MuteUserInVoiceConfSysMsg]) case None => log.error("Failed to deserialize message: error: {} \n msg: {}", error, jsonNode) None @@ -64,10 +64,10 @@ trait RxJsonMsgDeserializer { } def routeTransferUserToVoiceConfMsg(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = { - def deserialize(jsonNode: JsonNode): Option[TransferUserToVoiceConfMsg] = { - val (result, error) = JsonDeserializer.toBbbCommonMsg[TransferUserToVoiceConfMsg](jsonNode) + def deserialize(jsonNode: JsonNode): Option[TransferUserToVoiceConfSysMsg] = { + val (result, error) = JsonDeserializer.toBbbCommonMsg[TransferUserToVoiceConfSysMsg](jsonNode) result match { - case Some(msg) => Some(msg.asInstanceOf[TransferUserToVoiceConfMsg]) + case Some(msg) => Some(msg.asInstanceOf[TransferUserToVoiceConfSysMsg]) case None => log.error("Failed to deserialize message: error: {} \n msg: {}", error, jsonNode) None @@ -82,10 +82,10 @@ trait RxJsonMsgDeserializer { } def routeStartRecordingVoiceConfMsg(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = { - def deserialize(jsonNode: JsonNode): Option[StartRecordingVoiceConfMsg] = { - val (result, error) = JsonDeserializer.toBbbCommonMsg[StartRecordingVoiceConfMsg](jsonNode) + def deserialize(jsonNode: JsonNode): Option[StartRecordingVoiceConfSysMsg] = { + val (result, error) = JsonDeserializer.toBbbCommonMsg[StartRecordingVoiceConfSysMsg](jsonNode) result match { - case Some(msg) => Some(msg.asInstanceOf[StartRecordingVoiceConfMsg]) + case Some(msg) => Some(msg.asInstanceOf[StartRecordingVoiceConfSysMsg]) case None => log.error("Failed to deserialize message: error: {} \n msg: {}", error, jsonNode) None @@ -100,10 +100,10 @@ trait RxJsonMsgDeserializer { } def routeStopRecordingVoiceConfMsg(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = { - def deserialize(jsonNode: JsonNode): Option[StopRecordingVoiceConfMsg] = { - val (result, error) = JsonDeserializer.toBbbCommonMsg[StopRecordingVoiceConfMsg](jsonNode) + def deserialize(jsonNode: JsonNode): Option[StopRecordingVoiceConfSysMsg] = { + val (result, error) = JsonDeserializer.toBbbCommonMsg[StopRecordingVoiceConfSysMsg](jsonNode) result match { - case Some(msg) => Some(msg.asInstanceOf[StopRecordingVoiceConfMsg]) + case Some(msg) => Some(msg.asInstanceOf[StopRecordingVoiceConfSysMsg]) case None => log.error("Failed to deserialize message: error: {} \n msg: {}", error, jsonNode) None diff --git a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgHdlrActor.scala b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgHdlrActor.scala index 33a6bb176c..143d6e5393 100755 --- a/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgHdlrActor.scala +++ b/akka-bbb-fsesl/src/main/scala/org/bigbluebutton/freeswitch/RxJsonMsgHdlrActor.scala @@ -32,15 +32,15 @@ class RxJsonMsgHdlrActor(val fsApp: FreeswitchApplication) extends Actor with Ac envelope.name match { case EjectAllFromVoiceConfMsg.NAME => routeEjectAllFromVoiceConfMsg(envelope, jsonNode) - case EjectUserFromVoiceConfMsg.NAME => + case EjectUserFromVoiceConfSysMsg.NAME => routeEjectUserFromVoiceConfMsg(envelope, jsonNode) - case MuteUserInVoiceConfMsg.NAME => + case MuteUserInVoiceConfSysMsg.NAME => routeMuteUserInVoiceConfMsg(envelope, jsonNode) - case TransferUserToVoiceConfMsg.NAME => + case TransferUserToVoiceConfSysMsg.NAME => routeTransferUserToVoiceConfMsg(envelope, jsonNode) - case StartRecordingVoiceConfMsg.NAME => + case StartRecordingVoiceConfSysMsg.NAME => routeStartRecordingVoiceConfMsg(envelope, jsonNode) - case StopRecordingVoiceConfMsg.NAME => + case StopRecordingVoiceConfSysMsg.NAME => routeStopRecordingVoiceConfMsg(envelope, jsonNode) case _ => // do nothing } diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala index abc7137aa3..a792a09044 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/bus/ReceivedJsonMsgHdlrActor.scala @@ -81,8 +81,8 @@ class ReceivedJsonMsgHdlrActor(val msgFromAkkaAppsEventBus: MsgFromAkkaAppsEvent route[UserBroadcastCamStartedEvtMsg](envelope, jsonNode) case UserBroadcastCamStoppedEvtMsg.NAME => route[UserBroadcastCamStoppedEvtMsg](envelope, jsonNode) - case CreateBreakoutRoomEvtMsg.NAME => - route[CreateBreakoutRoomEvtMsg](envelope, jsonNode) + case CreateBreakoutRoomSysCmdMsg.NAME => + route[CreateBreakoutRoomSysCmdMsg](envelope, jsonNode) case EndBreakoutRoomEvtMsg.NAME => route[EndBreakoutRoomEvtMsg](envelope, jsonNode) diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala index ba2d9efd82..56d2e698c5 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala @@ -32,7 +32,7 @@ class OldMeetingMsgHdlrActor(val olgMsgGW: OldMessageReceivedGW) case m: UserLeftVoiceConfToClientEvtMsg => handleUserLeftVoiceConfToClientEvtMsg(m) case m: UserBroadcastCamStartedEvtMsg => handleUserBroadcastCamStartedEvtMsg(m) case m: UserBroadcastCamStoppedEvtMsg => handleUserBroadcastCamStoppedEvtMsg(m) - case m: CreateBreakoutRoomEvtMsg => handleCreateBreakoutRoomSysCmdMsg(m) + case m: CreateBreakoutRoomSysCmdMsg => handleCreateBreakoutRoomSysCmdMsg(m) case m: EndBreakoutRoomEvtMsg => handleEndBreakoutRoomEvtMsg(m) case _ => log.error("***** Cannot handle " + msg.envelope.name) } @@ -50,7 +50,7 @@ class OldMeetingMsgHdlrActor(val olgMsgGW: OldMessageReceivedGW) olgMsgGW.handle(new MeetingDestroyed(msg.body.meetingId)) } - def handleCreateBreakoutRoomSysCmdMsg(msg: CreateBreakoutRoomEvtMsg): Unit = { + def handleCreateBreakoutRoomSysCmdMsg(msg: CreateBreakoutRoomSysCmdMsg): Unit = { olgMsgGW.handle(new CreateBreakoutRoom( msg.body.room.breakoutMeetingId, msg.body.room.parentId, From 550b880db77d075dd82c9252147aa5ffdaa90a76 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Fri, 7 Jul 2017 19:14:00 -0400 Subject: [PATCH 24/28] convert chat messages to 2x --- .../org/bigbluebutton/core/apps/ChatApp.scala | 8 +- .../core/apps/ChatAppHandlers.scala | 29 ----- .../bigbluebutton/core/apps/ChatModel.scala | 37 +++--- .../core/apps/ChatModelTrait.scala | 19 --- .../core/apps/chat/ChatApp2x.scala | 18 +++ .../ClearPublicChatHistoryPubMsgHdlr.scala | 30 +++++ .../apps/chat/GetChatHistoryReqMsgHdlr.scala | 27 ++++ .../chat/SendPrivateMessagePubMsgHdlr.scala | 28 +++++ .../chat/SendPublicMessagePubMsgHdlr.scala | 29 +++++ .../senders/ReceivedJsonMsgHandlerActor.scala | 8 ++ .../core/running/LiveMeeting.scala | 35 +++--- .../core/running/MeetingActor.scala | 8 ++ .../common2/msgs/ChatMessages.scala | 39 ++++++ .../modules/chat/events/ChatEvent.as | 3 - ...TranscriptEvent.as => ChatHistoryEvent.as} | 10 +- .../chat/events/PublicChatMessageEvent.as | 1 - .../modules/chat/maps/ChatEventMap.mxml | 8 +- .../modules/chat/model/ChatConversation.as | 108 +++++++++------- .../modules/chat/model/ChatConverstations.as | 2 +- .../chat/services/ChatMessageService.as | 22 ++-- .../modules/chat/services/MessageReceiver.as | 89 ++++++------- .../modules/chat/services/MessageSender.as | 117 ++++++++++-------- .../modules/chat/views/AddChatTabBox.mxml | 6 +- .../modules/chat/views/AdvancedList.as | 2 +- .../modules/chat/views/ChatBox.mxml | 53 ++++---- .../modules/chat/views/ChatControlBar.mxml | 29 ----- .../modules/chat/views/ChatToolbar.mxml | 1 + .../modules/chat/views/ChatView.mxml | 12 +- .../modules/chat/views/UserRenderer.mxml | 6 + .../modules/chat/vo/ChatMessageVO.as | 31 +---- .../polling/service/PollDataProcessor.as | 6 +- 31 files changed, 460 insertions(+), 361 deletions(-) delete mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatAppHandlers.scala delete mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModelTrait.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp2x.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ClearPublicChatHistoryPubMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/GetChatHistoryReqMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPrivateMessagePubMsgHdlr.scala create mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPublicMessagePubMsgHdlr.scala create mode 100755 bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ChatMessages.scala rename bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/{TranscriptEvent.as => ChatHistoryEvent.as} (76%) mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConverstations.as mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as delete mode 100755 bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatControlBar.mxml mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala index 0a3d431b81..400a4b210d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala @@ -12,12 +12,12 @@ trait ChatApp { val outGW: OutMessageGateway def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { - val history = liveMeeting.chatModel.getChatHistory() - outGW.send(new GetChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID, msg.replyTo, history)) + //val history = liveMeeting.chatModel.getChatHistory() + //outGW.send(new GetChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID, msg.replyTo, history)) } def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { - liveMeeting.chatModel.addNewChatMessage(msg.message) + //liveMeeting.chatModel.addNewChatMessage(msg.message) val pubMsg = msg.message outGW.send(new SendPublicMessageEvent(props.meetingProp.intId, props.recordProp.record, msg.requesterID, pubMsg)) @@ -29,7 +29,7 @@ trait ChatApp { } def handleClearPublicChatHistoryRequest(msg: ClearPublicChatHistoryRequest) { - liveMeeting.chatModel.clearPublicChatHistory() + //liveMeeting.chatModel.clearPublicChatHistory() outGW.send(new ClearPublicChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID)) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatAppHandlers.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatAppHandlers.scala deleted file mode 100755 index 0424174c09..0000000000 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatAppHandlers.scala +++ /dev/null @@ -1,29 +0,0 @@ -package org.bigbluebutton.core.apps - -import org.bigbluebutton.core.OutMessageGateway -import org.bigbluebutton.core.api.SendDirectChatMsgCmd -import org.bigbluebutton.core.models.DirectChats -import org.bigbluebutton.core.running.LiveMeeting - -trait ChatAppHandlers { - val liveMeeting: LiveMeeting - val outGW: OutMessageGateway - - def handleSendDirectChatMsgCmd(msg: SendDirectChatMsgCmd): Unit = { - def send(): Unit = { - - } - - val between = Set("foo", "bar") - for { - chat <- DirectChats.find(between, liveMeeting.chatModel.directChats) - - } yield { - send() - } - } - - def handleCreatePublicChatCmd(): Unit = { - - } -} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala index 6ea09a2aef..f6a985245a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModel.scala @@ -1,35 +1,28 @@ package org.bigbluebutton.core.apps +import org.bigbluebutton.common2.msgs.ChatMessageVO import org.bigbluebutton.core.models.{ DirectChats, PublicChats } import scala.collection.mutable.ArrayBuffer object ChatModel { - def getChatHistory(chatModel: ChatModel): Array[Map[String, String]] = { - chatModel.getChatHistory() + def getChatHistory(chatModel: ChatModel): Array[ChatMessageVO] = { + chatModel.messages.toArray + } + + def addNewChatMessage(chatModel: ChatModel, msg: ChatMessageVO) { + chatModel.messages.append(msg) + } + + def clearPublicChatHistory(chatModel: ChatModel) { + chatModel.messages.clear() } } class ChatModel { - val directChats = new DirectChats - val publicChats = new PublicChats - - private val messages = new ArrayBuffer[Map[String, String]]() - - def getChatHistory(): Array[Map[String, String]] = { - val history = new Array[Map[String, String]](messages.size) - messages.copyToArray(history) - - history - } - - def addNewChatMessage(msg: Map[String, String]) { - messages append msg - } - - def clearPublicChatHistory() { - messages.clear(); - } -} + //val directChats = new DirectChats + //val publicChats = new PublicChats + private val messages = new ArrayBuffer[ChatMessageVO]() +} \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModelTrait.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModelTrait.scala deleted file mode 100755 index c923560e0f..0000000000 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatModelTrait.scala +++ /dev/null @@ -1,19 +0,0 @@ -package org.bigbluebutton.core.apps - -import org.bigbluebutton.core.running.LiveMeeting - -trait ChatModelTrait { - this: LiveMeeting => - - def getChatHistory(): Array[Map[String, String]] = { - ChatModel.getChatHistory(chatModel) - } - - def addNewChatMessage(msg: Map[String, String]) = { - chatModel.addNewChatMessage(msg) - } - - def clearPublicChatHistory(): Unit = { - chatModel.clearPublicChatHistory() - } -} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp2x.scala new file mode 100755 index 0000000000..ccbaf5d82a --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ChatApp2x.scala @@ -0,0 +1,18 @@ +package org.bigbluebutton.core.apps.chat + +import akka.actor.ActorContext +import akka.event.Logging +import org.bigbluebutton.common2.msgs.TranscriptVO +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.core.running.LiveMeeting + +class ChatApp2x(val liveMeeting: LiveMeeting, + val outGW: OutMessageGateway)(implicit val context: ActorContext) + extends GetChatHistoryReqMsgHdlr + with SendPublicMessagePubMsgHdlr + with SendPrivateMessagePubMsgHdlr + with ClearPublicChatHistoryPubMsgHdlr { + + val log = Logging(context.system, getClass) + +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ClearPublicChatHistoryPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ClearPublicChatHistoryPubMsgHdlr.scala new file mode 100755 index 0000000000..8f700f99b7 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/ClearPublicChatHistoryPubMsgHdlr.scala @@ -0,0 +1,30 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.apps.ChatModel + +trait ClearPublicChatHistoryPubMsgHdlr { + this: ChatApp2x => + + val outGW: OutMessageGateway + + def handleClearPublicChatHistoryPubMsg(msg: ClearPublicChatHistoryPubMsg): Unit = { + def broadcastEvent(msg: ClearPublicChatHistoryPubMsg): Unit = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId) + val envelope = BbbCoreEnvelope(ClearPublicChatHistoryEvtMsg.NAME, routing) + val header = BbbClientMsgHeader(ClearPublicChatHistoryEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId) + + val body = ClearPublicChatHistoryEvtMsgBody() + val event = ClearPublicChatHistoryEvtMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + outGW.send(msgEvent) + + //record(event) + } + + ChatModel.clearPublicChatHistory(liveMeeting.chatModel) + broadcastEvent(msg) + } + +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/GetChatHistoryReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/GetChatHistoryReqMsgHdlr.scala new file mode 100755 index 0000000000..cbdc44863d --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/GetChatHistoryReqMsgHdlr.scala @@ -0,0 +1,27 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.apps.ChatModel + +trait GetChatHistoryReqMsgHdlr { + this: ChatApp2x => + + val outGW: OutMessageGateway + + def handleGetChatHistoryReqMsg(msg: GetChatHistoryReqMsg): Unit = { + def broadcastEvent(msg: GetChatHistoryReqMsg, history: Array[ChatMessageVO]): Unit = { + val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, msg.header.userId) + val envelope = BbbCoreEnvelope(GetChatHistoryRespMsg.NAME, routing) + val header = BbbClientMsgHeader(GetChatHistoryRespMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId) + + val body = GetChatHistoryRespMsgBody(history) + val event = GetChatHistoryRespMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + outGW.send(msgEvent) + } + + val history = ChatModel.getChatHistory(liveMeeting.chatModel) + broadcastEvent(msg, history) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPrivateMessagePubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPrivateMessagePubMsgHdlr.scala new file mode 100755 index 0000000000..3ccd5c6ad2 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPrivateMessagePubMsgHdlr.scala @@ -0,0 +1,28 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.common2.msgs._ + +trait SendPrivateMessagePubMsgHdlr { + this: ChatApp2x => + + val outGW: OutMessageGateway + + def handleSendPrivateMessagePubMsg(msg: SendPrivateMessagePubMsg): Unit = { + def broadcastEvent(message: ChatMessageVO, userId: String): Unit = { + val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, liveMeeting.props.meetingProp.intId, userId) + val envelope = BbbCoreEnvelope(SendPrivateMessageEvtMsg.NAME, routing) + val header = BbbClientMsgHeader(SendPrivateMessageEvtMsg.NAME, liveMeeting.props.meetingProp.intId, userId) + + val body = SendPrivateMessageEvtMsgBody(message) + val event = SendPrivateMessageEvtMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + outGW.send(msgEvent) + + //record(event) + } + + broadcastEvent(msg.body.message, msg.body.message.fromUserId) + broadcastEvent(msg.body.message, msg.body.message.toUserId) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPublicMessagePubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPublicMessagePubMsgHdlr.scala new file mode 100755 index 0000000000..773a0cbed5 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/chat/SendPublicMessagePubMsgHdlr.scala @@ -0,0 +1,29 @@ +package org.bigbluebutton.core.apps.chat + +import org.bigbluebutton.core.OutMessageGateway +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.apps.ChatModel + +trait SendPublicMessagePubMsgHdlr { + this: ChatApp2x => + + val outGW: OutMessageGateway + + def handleSendPublicMessagePubMsg(msg: SendPublicMessagePubMsg): Unit = { + def broadcastEvent(msg: SendPublicMessagePubMsg, message: ChatMessageVO): Unit = { + val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId) + val envelope = BbbCoreEnvelope(SendPublicMessageEvtMsg.NAME, routing) + val header = BbbClientMsgHeader(SendPublicMessageEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId) + + val body = SendPublicMessageEvtMsgBody(msg.body.message) + val event = SendPublicMessageEvtMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + outGW.send(msgEvent) + + //record(event) + } + + ChatModel.addNewChatMessage(liveMeeting.chatModel, msg.body.message) + broadcastEvent(msg, msg.body.message) + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index 0fc6b3c6e2..c8190299f4 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -295,6 +295,14 @@ class ReceivedJsonMsgHandlerActor( routeGenericMsg[CreateSharedNoteReqMsg](envelope, jsonNode) case DestroySharedNoteReqMsg.NAME => routeGenericMsg[DestroySharedNoteReqMsg](envelope, jsonNode) + case GetChatHistoryReqMsg.NAME => + routeGenericMsg[GetChatHistoryReqMsg](envelope, jsonNode) + case SendPublicMessagePubMsg.NAME => + routeGenericMsg[SendPublicMessagePubMsg](envelope, jsonNode) + case SendPrivateMessagePubMsg.NAME => + routeGenericMsg[SendPrivateMessagePubMsg](envelope, jsonNode) + case ClearPublicChatHistoryPubMsg.NAME => + routeGenericMsg[ClearPublicChatHistoryPubMsg](envelope, jsonNode) case _ => log.error("Cannot route envelope name " + envelope.name) // do nothing diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/LiveMeeting.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/LiveMeeting.scala index 6e980ea7ee..7bc95cca8a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/LiveMeeting.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/LiveMeeting.scala @@ -9,24 +9,23 @@ import org.bigbluebutton.core.models._ import org.bigbluebutton.core2.MeetingStatus2x class LiveMeeting(val props: DefaultProps, - val status: MeetingStatus2x, - val chatModel: ChatModel, - val layoutModel: LayoutModel, - val layouts: Layouts, - val users: Users1x, - val registeredUsers: RegisteredUsers, - val polls: Polls, // 2x - val pollModel: PollModel, // 1.1x - val wbModel: WhiteboardModel, - val presModel: PresentationModel, - val breakoutRooms: BreakoutRooms, - val captionModel: CaptionModel, - val notesModel: SharedNotesModel, - val webcams: Webcams, - val voiceUsers: VoiceUsers, - val users2x: Users2x, - val guestsWaiting: GuestsWaiting) - extends ChatModelTrait { + val status: MeetingStatus2x, + val chatModel: ChatModel, + val layoutModel: LayoutModel, + val layouts: Layouts, + val users: Users1x, + val registeredUsers: RegisteredUsers, + val polls: Polls, // 2x + val pollModel: PollModel, // 1.1x + val wbModel: WhiteboardModel, + val presModel: PresentationModel, + val breakoutRooms: BreakoutRooms, + val captionModel: CaptionModel, + val notesModel: SharedNotesModel, + val webcams: Webcams, + val voiceUsers: VoiceUsers, + val users2x: Users2x, + val guestsWaiting: GuestsWaiting) { def hasMeetingEnded(): Boolean = { MeetingStatus2x.hasMeetingEnded(status) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index 3a565d4b6b..feff4f7592 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -9,6 +9,7 @@ import org.bigbluebutton.core._ import org.bigbluebutton.core.api._ import org.bigbluebutton.core.apps._ import org.bigbluebutton.core.apps.caption.CaptionApp2x +import org.bigbluebutton.core.apps.chat.ChatApp2x import org.bigbluebutton.core.apps.deskshare.DeskshareApp2x import org.bigbluebutton.core.apps.presentation.PresentationApp2x import org.bigbluebutton.core.apps.users.UsersApp2x @@ -103,6 +104,7 @@ class MeetingActor(val props: DefaultProps, val deskshareApp2x = new DeskshareApp2x(liveMeeting, outGW = outGW) val captionApp2x = new CaptionApp2x(liveMeeting, outGW = outGW) val sharedNotesApp2x = new SharedNotesApp2x(liveMeeting, outGW = outGW) + val chatApp2x = new ChatApp2x(liveMeeting, outGW = outGW) /*******************************************************************/ //object FakeTestData extends FakeTestData @@ -237,6 +239,12 @@ class MeetingActor(val props: DefaultProps, case m: CreateSharedNoteReqMsg => sharedNotesApp2x.handleCreateSharedNoteReqMsg(m) case m: DestroySharedNoteReqMsg => sharedNotesApp2x.handleDestroySharedNoteReqMsg(m) + // Chat + case m: GetChatHistoryReqMsg => chatApp2x.handleGetChatHistoryReqMsg(m) + case m: SendPublicMessagePubMsg => chatApp2x.handleSendPublicMessagePubMsg(m) + case m: SendPrivateMessagePubMsg => chatApp2x.handleSendPrivateMessagePubMsg(m) + case m: ClearPublicChatHistoryPubMsg => chatApp2x.handleClearPublicChatHistoryPubMsg(m) + //Guests case m: GetGuestsWaitingApprovalReqMsg => handle(m) case m: SetGuestPolicyMsg => handle(m) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ChatMessages.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ChatMessages.scala new file mode 100755 index 0000000000..c12ec7665d --- /dev/null +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ChatMessages.scala @@ -0,0 +1,39 @@ +package org.bigbluebutton.common2.msgs + + +/* In Messages */ +object GetChatHistoryReqMsg { val NAME = "GetChatHistoryReqMsg"} +case class GetChatHistoryReqMsg(header: BbbClientMsgHeader, body: GetChatHistoryReqMsgBody) extends StandardMsg +case class GetChatHistoryReqMsgBody() + +object SendPublicMessagePubMsg { val NAME = "SendPublicMessagePubMsg"} +case class SendPublicMessagePubMsg(header: BbbClientMsgHeader, body: SendPublicMessagePubMsgBody) extends StandardMsg +case class SendPublicMessagePubMsgBody(message: ChatMessageVO) + +object SendPrivateMessagePubMsg { val NAME = "SendPrivateMessagePubMsg"} +case class SendPrivateMessagePubMsg(header: BbbClientMsgHeader, body: SendPrivateMessagePubMsgBody) extends StandardMsg +case class SendPrivateMessagePubMsgBody(message: ChatMessageVO) + +object ClearPublicChatHistoryPubMsg { val NAME = "ClearPublicChatHistoryPubMsg"} +case class ClearPublicChatHistoryPubMsg(header: BbbClientMsgHeader, body: ClearPublicChatHistoryPubMsgBody) extends StandardMsg +case class ClearPublicChatHistoryPubMsgBody() + +/* Out Messages */ +object GetChatHistoryRespMsg { val NAME = "GetChatHistoryRespMsg"} +case class GetChatHistoryRespMsg(header: BbbClientMsgHeader, body: GetChatHistoryRespMsgBody) extends StandardMsg +case class GetChatHistoryRespMsgBody(history: Array[ChatMessageVO]) + +object SendPublicMessageEvtMsg { val NAME = "SendPublicMessageEvtMsg"} +case class SendPublicMessageEvtMsg(header: BbbClientMsgHeader, body: SendPublicMessageEvtMsgBody) extends StandardMsg +case class SendPublicMessageEvtMsgBody(message: ChatMessageVO) + +object SendPrivateMessageEvtMsg { val NAME = "SendPrivateMessageEvtMsg"} +case class SendPrivateMessageEvtMsg(header: BbbClientMsgHeader, body: SendPrivateMessageEvtMsgBody) extends StandardMsg +case class SendPrivateMessageEvtMsgBody(message: ChatMessageVO) + +object ClearPublicChatHistoryEvtMsg { val NAME = "ClearPublicChatHistoryEvtMsg"} +case class ClearPublicChatHistoryEvtMsg(header: BbbClientMsgHeader, body: ClearPublicChatHistoryEvtMsgBody) extends StandardMsg +case class ClearPublicChatHistoryEvtMsgBody() + +case class ChatMessageVO(fromUserId: String, fromUsername: String, fromColor: String, fromTime: Long, fromTimezoneOffset: Int, + toUserId: String, toUsername: String, message: String) \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatEvent.as index 580ed3ebff..472328ea3b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatEvent.as @@ -23,9 +23,6 @@ package org.bigbluebutton.modules.chat.events public class ChatEvent extends Event { - public static const CHAT_EVENT:String = 'CHAT_EVENT'; - public static const NEW_CHAT_MESSAGE_EVENT:String = 'NEW_CHAT_MESSAGE_EVENT'; - public static const PRIVATE_CHAT_MESSAGE_EVENT:String = 'PRIVATE_CHAT_MESSAGE_EVENT'; public static const RESIZE_CHAT_TOOLBAR:String = 'RESIZE_CHAT_TOOLBAR'; public function ChatEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/TranscriptEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatHistoryEvent.as similarity index 76% rename from bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/TranscriptEvent.as rename to bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatHistoryEvent.as index 38d54fb9e6..4cb4fb111e 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/TranscriptEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/ChatHistoryEvent.as @@ -20,12 +20,14 @@ package org.bigbluebutton.modules.chat.events { import flash.events.Event; - public class TranscriptEvent extends Event + public class ChatHistoryEvent extends Event { - public static const LOAD_TRANSCRIPT:String = "LOAD_TRANSCRIPT"; - public static const TRANSCRIPT_EVENT:String = 'TRANSCRIPT_EVENT'; + public static const REQUEST_HISTORY:String = "REQUEST_HISTORY"; + public static const RECEIVED_HISTORY:String = 'RECEIVED_HISTORY'; - public function TranscriptEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) + public var history:Array; + + public function ChatHistoryEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) { super(type, bubbles, cancelable); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/PublicChatMessageEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/PublicChatMessageEvent.as index feabe4380e..b19fd4ff90 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/PublicChatMessageEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/events/PublicChatMessageEvent.as @@ -27,7 +27,6 @@ package org.bigbluebutton.modules.chat.events public static const PUBLIC_CHAT_MESSAGE_EVENT:String = 'PUBLIC_CHAT_MESSAGE_EVENT'; public var message:ChatMessageVO; - public var history:Boolean; public function PublicChatMessageEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml index e0ed5f49df..6e7b853ee2 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/maps/ChatEventMap.mxml @@ -39,7 +39,7 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.chat.events.SendPublicChatMessageEvent; import org.bigbluebutton.modules.chat.events.StartChatModuleEvent; import org.bigbluebutton.modules.chat.events.StopChatModuleEvent; - import org.bigbluebutton.modules.chat.events.TranscriptEvent; + import org.bigbluebutton.modules.chat.events.ChatHistoryEvent; import org.bigbluebutton.modules.chat.services.ChatMessageService; import org.bigbluebutton.modules.chat.services.MessageReceiver; import org.bigbluebutton.modules.chat.services.MessageSender; @@ -79,16 +79,16 @@ with BigBlueButton; if not, see . - + - + - + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as old mode 100644 new mode 100755 index 49ce915729..e4807be8f7 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConversation.as @@ -19,17 +19,16 @@ package org.bigbluebutton.modules.chat.model { import com.adobe.utils.StringUtil; - + import com.asfusion.mate.events.Dispatcher; + import flash.system.Capabilities; import mx.collections.ArrayCollection; - import com.asfusion.mate.events.Dispatcher; - import org.bigbluebutton.modules.chat.ChatUtil; - import org.bigbluebutton.util.i18n.ResourceUtil; + import org.bigbluebutton.modules.chat.events.ChatHistoryEvent; import org.bigbluebutton.modules.chat.vo.ChatMessageVO; - import org.bigbluebutton.modules.chat.events.TranscriptEvent; + import org.bigbluebutton.util.i18n.ResourceUtil; public class ChatConversation { @@ -44,34 +43,65 @@ package org.bigbluebutton.modules.chat.model } public function newChatMessage(msg:ChatMessageVO):void { - var cm:ChatMessage = new ChatMessage(); - - if (messages.length == 0) { - cm.lastSenderId = ""; - cm.lastTime = cm.time; - } else { - cm.lastSenderId = getLastSender(); - cm.lastTime = getLastTime(); - } - cm.senderId = msg.fromUserID; - - cm.text = msg.message; - - cm.name = msg.fromUsername; - cm.senderColor = uint(msg.fromColor); - - // Welcome message will skip time - if (msg.fromTime != -1) { - cm.fromTime = msg.fromTime; - cm.fromTimezoneOffset = msg.fromTimezoneOffset; - var sentTime:Date = new Date(); - sentTime.setTime(cm.fromTime); - cm.time = ChatUtil.getHours(sentTime) + ":" + ChatUtil.getMinutes(sentTime); - } - - messages.addItem(cm); + var newCM:ChatMessage = convertChatMessage(msg); + if (messages.length > 0) { + var previousCM:ChatMessage = messages.getItemAt(messages.length-1) as ChatMessage; + newCM.lastSenderId = previousCM.senderId; + newCM.lastTime = previousCM.time; + } + messages.addItem(newCM); } + public function processChatHistory(messageVOs:Array):void { + if (messageVOs.length > 0) { + var previousCM:ChatMessage = convertChatMessage(messageVOs[0] as ChatMessageVO);; + var newCM:ChatMessage; + messages.addItemAt(previousCM, 0); + + for (var i:int=1; i < messageVOs.length; i++) { + newCM = convertChatMessage(messageVOs[i] as ChatMessageVO); + newCM.lastSenderId = previousCM.senderId; + newCM.lastTime = previousCM.time; + messages.addItemAt(newCM, i); + previousCM = newCM; + } + + if (messageVOs.length < messages.length) { + newCM = messages.getItemAt(messageVOs.length) as ChatMessage; + newCM.lastSenderId = previousCM.senderId; + newCM.lastTime = previousCM.time; + } + } + } + + private function convertChatMessage(msgVO:ChatMessageVO):ChatMessage { + var cm:ChatMessage = new ChatMessage(); + + cm.lastSenderId = ""; + cm.lastTime = ""; + + cm.senderId = msgVO.fromUserId; + + cm.text = msgVO.message; + + cm.name = msgVO.fromUsername; + cm.senderColor = uint(msgVO.fromColor); + + // Welcome message will skip time + if (msgVO.fromTime != -1) { + cm.fromTime = msgVO.fromTime; + cm.fromTimezoneOffset = msgVO.fromTimezoneOffset; + cm.time = convertTimeNumberToString(msgVO.fromTime); + } + return cm + } + + private function convertTimeNumberToString(time:Number):String { + var sentTime:Date = new Date(); + sentTime.setTime(time); + return ChatUtil.getHours(sentTime) + ":" + ChatUtil.getMinutes(sentTime); + } + public function getAllMessageAsString():String{ var allText:String = ""; var returnStr:String = (Capabilities.os.indexOf("Windows") >= 0 ? "\r\n" : "\n"); @@ -85,28 +115,18 @@ package org.bigbluebutton.modules.chat.model } return allText; } - - private function getLastSender():String { - var msg:ChatMessage = messages.getItemAt(messages.length - 1) as ChatMessage; - return msg.senderId; - } - - private function getLastTime():String { - var msg:ChatMessage = messages.getItemAt(messages.length - 1) as ChatMessage; - return msg.time; - } public function clearPublicChat():void { var cm:ChatMessage = new ChatMessage(); - cm.time = getLastTime(); - cm.text = ""+ResourceUtil.getInstance().getString('bbb.chat.clearBtn.chatMessage')+""; + cm.time = convertTimeNumberToString(new Date().time); + cm.text = ""+ResourceUtil.getInstance().getString('bbb.chat.clearBtn.chatMessage')+""; cm.name = ""; cm.senderColor = uint(0x000000); messages.removeAll(); messages.addItem(cm); - var welcomeEvent:TranscriptEvent = new TranscriptEvent(TranscriptEvent.TRANSCRIPT_EVENT); + var welcomeEvent:ChatHistoryEvent = new ChatHistoryEvent(ChatHistoryEvent.RECEIVED_HISTORY); _dispatcher.dispatchEvent(welcomeEvent); } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConverstations.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConverstations.as old mode 100644 new mode 100755 index ae8ba09512..24297e7c7e --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConverstations.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatConverstations.as @@ -20,7 +20,7 @@ package org.bigbluebutton.modules.chat.model } public function newChatMessage(msg:ChatMessageVO):void { - var convId:String = getConvId(msg.fromUserID, msg.toUserID); + var convId:String = getConvId(msg.fromUserId, msg.toUserId); if (convs.hasOwnProperty(convId)) { var cm:ChatConversation = convs[convId] as ChatConversation; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as index e886d5f7dc..7c441f7279 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/ChatMessageService.as @@ -43,8 +43,7 @@ package org.bigbluebutton.modules.chat.services { LOGGER.debug("sendPublicMessageFromApi"); var msgVO:ChatMessageVO = new ChatMessageVO(); - msgVO.chatType = ChatConstants.PUBLIC_CHAT; - msgVO.fromUserID = message.fromUserID; + msgVO.fromUserId = message.fromUserID; msgVO.fromUsername = message.fromUsername; msgVO.fromColor = message.fromColor; msgVO.fromTime = message.fromTime; @@ -59,14 +58,13 @@ package org.bigbluebutton.modules.chat.services { LOGGER.debug("sendPrivateMessageFromApi"); var msgVO:ChatMessageVO = new ChatMessageVO(); - msgVO.chatType = ChatConstants.PUBLIC_CHAT; - msgVO.fromUserID = message.fromUserID; + msgVO.fromUserId = message.fromUserID; msgVO.fromUsername = message.fromUsername; msgVO.fromColor = message.fromColor; msgVO.fromTime = message.fromTime; msgVO.fromTimezoneOffset = message.fromTimezoneOffset; - msgVO.toUserID = message.toUserID; + msgVO.toUserId = message.toUserID; msgVO.toUsername = message.toUsername; msgVO.message = message.message; @@ -98,19 +96,17 @@ package org.bigbluebutton.modules.chat.services var welcome:String = LiveMeeting.inst().me.welcome; if (welcome != "") { var welcomeMsg:ChatMessageVO = new ChatMessageVO(); - welcomeMsg.chatType = ChatConstants.PUBLIC_CHAT; - welcomeMsg.fromUserID = SPACE; + welcomeMsg.fromUserId = SPACE; welcomeMsg.fromUsername = SPACE; welcomeMsg.fromColor = "86187"; - welcomeMsg.fromTime = -1; + welcomeMsg.fromTime = new Date().getTime(); welcomeMsg.fromTimezoneOffset = new Date().getTimezoneOffset(); - welcomeMsg.toUserID = SPACE; + welcomeMsg.toUserId = SPACE; welcomeMsg.toUsername = SPACE; welcomeMsg.message = welcome; var welcomeMsgEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT); welcomeMsgEvent.message = welcomeMsg; - welcomeMsgEvent.history = false; dispatcher.dispatchEvent(welcomeMsgEvent); //Say that client is ready when sending the welcome message @@ -120,19 +116,17 @@ package org.bigbluebutton.modules.chat.services if (UsersUtil.amIModerator()) { if (LiveMeeting.inst().meeting.modOnlyMessage != null) { var moderatorOnlyMsg:ChatMessageVO = new ChatMessageVO(); - moderatorOnlyMsg.chatType = ChatConstants.PUBLIC_CHAT; - moderatorOnlyMsg.fromUserID = SPACE; + moderatorOnlyMsg.fromUserId = SPACE; moderatorOnlyMsg.fromUsername = SPACE; moderatorOnlyMsg.fromColor = "86187"; moderatorOnlyMsg.fromTime = new Date().getTime(); moderatorOnlyMsg.fromTimezoneOffset = new Date().getTimezoneOffset(); - moderatorOnlyMsg.toUserID = SPACE; + moderatorOnlyMsg.toUserId = SPACE; moderatorOnlyMsg.toUsername = SPACE; moderatorOnlyMsg.message = LiveMeeting.inst().meeting.modOnlyMessage; var moderatorOnlyMsgEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT); moderatorOnlyMsgEvent.message = moderatorOnlyMsg; - moderatorOnlyMsgEvent.history = false; dispatcher.dispatchEvent(moderatorOnlyMsgEvent); } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as index 2a12acca00..1eeba2d43d 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageReceiver.as @@ -26,19 +26,17 @@ package org.bigbluebutton.modules.chat.services import org.bigbluebutton.core.EventConstants; import org.bigbluebutton.core.events.CoreEvent; import org.bigbluebutton.main.model.users.IMessageListener; + import org.bigbluebutton.modules.chat.events.ClearPublicChatEvent; import org.bigbluebutton.modules.chat.events.PrivateChatMessageEvent; import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent; - import org.bigbluebutton.modules.chat.events.TranscriptEvent; - import org.bigbluebutton.modules.chat.events.ClearPublicChatEvent; + import org.bigbluebutton.modules.chat.events.ChatHistoryEvent; import org.bigbluebutton.modules.chat.vo.ChatMessageVO; public class MessageReceiver implements IMessageListener { - private static const LOGGER:ILogger = getClassLogger(MessageReceiver); - - private var welcomed:Boolean = false; - + private static const LOGGER:ILogger = getClassLogger(MessageReceiver); + public var dispatcher:IEventDispatcher; public function MessageReceiver() @@ -49,55 +47,44 @@ package org.bigbluebutton.modules.chat.services public function onMessage(messageName:String, message:Object):void { switch (messageName) { - case "ChatReceivePublicMessageCommand": - handleChatReceivePublicMessageCommand(message); + case "SendPublicMessageEvtMsg": + handleSendPublicMessageEvtMsg(message); break; - case "ChatReceivePrivateMessageCommand": - handleChatReceivePrivateMessageCommand(message); + case "SendPrivateMessageEvtMsg": + handleSendPrivateMessageEvtMsg(message); break; - case "ChatRequestMessageHistoryReply": - handleChatRequestMessageHistoryReply(message); + case "GetChatHistoryRespMsg": + handleGetChatHistoryRespMsg(message); break; - case "ChatClearPublicMessageCommand": - handleChatClearPublicMessageCommand(message); + case "ClearPublicChatHistoryEvtMsg": + handleClearPublicChatHistoryEvtMsg(message); break; default: // LogUtil.warn("Cannot handle message [" + messageName + "]"); } } - private function handleChatRequestMessageHistoryReply(message:Object):void { - LOGGER.debug("Handling chat history message [{0}]", [message.msg]); - var chats:Array = JSON.parse(message.msg) as Array; + private function handleGetChatHistoryRespMsg(message:Object):void { + LOGGER.debug("Handling chat history message [{0}]", [message.body.history]); + var rawMessages:Array = message.body.history as Array; + var processedMessages:Array = new Array(); - for (var i:int = 0; i < chats.length; i++) { - handleChatReceivePublicMessageCommand(chats[i], true); + for (var i:int = 0; i < rawMessages.length; i++) { + processedMessages.push(processIncomingChatMessage(rawMessages[i])); } -// if (!welcomed) { - var pcEvent:TranscriptEvent = new TranscriptEvent(TranscriptEvent.TRANSCRIPT_EVENT); - dispatcher.dispatchEvent(pcEvent); -// welcomed = true; -// } + var chEvent:ChatHistoryEvent = new ChatHistoryEvent(ChatHistoryEvent.RECEIVED_HISTORY); + chEvent.history = processedMessages; + dispatcher.dispatchEvent(chEvent); } - - private function handleChatReceivePublicMessageCommand(message:Object, history:Boolean = false):void { + + private function handleSendPublicMessageEvtMsg(message:Object, history:Boolean = false):void { LOGGER.debug("Handling public chat message [{0}]", [message.message]); - var msg:ChatMessageVO = new ChatMessageVO(); - msg.chatType = message.chatType; - msg.fromUserID = message.fromUserID; - msg.fromUsername = message.fromUsername; - msg.fromColor = message.fromColor; - msg.fromTime = message.fromTime; - msg.fromTimezoneOffset = message.fromTimezoneOffset; - msg.toUserID = message.toUserID; - msg.toUsername = message.toUsername; - msg.message = message.message; + var msg:ChatMessageVO = processIncomingChatMessage(message.body.message); var pcEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT); pcEvent.message = msg; - pcEvent.history = history; dispatcher.dispatchEvent(pcEvent); var pcCoreEvent:CoreEvent = new CoreEvent(EventConstants.NEW_PUBLIC_CHAT); @@ -105,19 +92,10 @@ package org.bigbluebutton.modules.chat.services dispatcher.dispatchEvent(pcCoreEvent); } - private function handleChatReceivePrivateMessageCommand(message:Object):void { + private function handleSendPrivateMessageEvtMsg(message:Object):void { LOGGER.debug("Handling private chat message"); - var msg:ChatMessageVO = new ChatMessageVO(); - msg.chatType = message.chatType; - msg.fromUserID = message.fromUserID; - msg.fromUsername = message.fromUsername; - msg.fromColor = message.fromColor; - msg.fromTime = message.fromTime; - msg.fromTimezoneOffset = message.fromTimezoneOffset; - msg.toUserID = message.toUserID; - msg.toUsername = message.toUsername; - msg.message = message.message; + var msg:ChatMessageVO = processIncomingChatMessage(message.body.message); var pcEvent:PrivateChatMessageEvent = new PrivateChatMessageEvent(PrivateChatMessageEvent.PRIVATE_CHAT_MESSAGE_EVENT); pcEvent.message = msg; @@ -128,11 +106,24 @@ package org.bigbluebutton.modules.chat.services dispatcher.dispatchEvent(pcCoreEvent); } - private function handleChatClearPublicMessageCommand(message:Object):void { + private function handleClearPublicChatHistoryEvtMsg(message:Object):void { LOGGER.debug("Handling clear chat history message"); var clearChatEvent:ClearPublicChatEvent = new ClearPublicChatEvent(ClearPublicChatEvent.CLEAR_PUBLIC_CHAT_EVENT); dispatcher.dispatchEvent(clearChatEvent); } + + private function processIncomingChatMessage(rawMessage:Object):ChatMessageVO { + var msg:ChatMessageVO = new ChatMessageVO(); + msg.fromUserId = rawMessage.fromUserId; + msg.fromUsername = rawMessage.fromUsername; + msg.fromColor = rawMessage.fromColor; + msg.fromTime = rawMessage.fromTime; + msg.fromTimezoneOffset = rawMessage.fromTimezoneOffset; + msg.toUserId = rawMessage.toUserId; + msg.toUsername = rawMessage.toUsername; + msg.message = rawMessage.message; + return msg; + } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as old mode 100644 new mode 100755 index 5871879fcb..ef15c2e4c9 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/services/MessageSender.as @@ -23,71 +23,86 @@ package org.bigbluebutton.modules.chat.services import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; import org.bigbluebutton.core.BBB; + import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.managers.ConnectionManager; import org.bigbluebutton.modules.chat.vo.ChatMessageVO; public class MessageSender { - private static const LOGGER:ILogger = getClassLogger(MessageSender); + private static const LOGGER:ILogger = getClassLogger(MessageSender); public var dispatcher:IEventDispatcher; - public function getPublicChatMessages():void - { + public function getPublicChatMessages():void { LOGGER.debug("Sending [chat.getPublicMessages] to server."); + var message:Object = { + header: {name: "GetChatHistoryReqMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()}, + body: {} + }; + var _nc:ConnectionManager = BBB.initConnectionManager(); - _nc.sendMessage("chat.sendPublicChatHistory", + _nc.sendMessage2x( function(result:String):void { // On successful result - LOGGER.debug(result); - }, - function(status:String):void { // status - On error occurred - LOGGER.error(status); - } - ); - } - - public function sendPublicMessage(message:ChatMessageVO):void - { - LOGGER.debug("Sending [chat.sendPublicMessage] to server. [{0}]", [message.message]); - var _nc:ConnectionManager = BBB.initConnectionManager(); - _nc.sendMessage("chat.sendPublicMessage", - function(result:String):void { // On successful result - LOGGER.debug(result); - }, - function(status:String):void { // status - On error occurred - LOGGER.error(status); - }, - message.toObj() - ); - } - - public function sendPrivateMessage(message:ChatMessageVO):void - { - LOGGER.debug("Sending [chat.sendPrivateMessage] to server."); - LOGGER.debug("Sending fromUserID [{0}] to toUserID [{1}]", [message.fromUserID, message.toUserID]); - var _nc:ConnectionManager = BBB.initConnectionManager(); - _nc.sendMessage("chat.sendPrivateMessage", - function(result:String):void { // On successful result - LOGGER.debug(result); - }, - function(status:String):void { // status - On error occurred - LOGGER.error(status); - }, - message.toObj() - ); - } - - public function clearPublicChatMessages():void - { - LOGGER.debug("Sending [chat.clearPublicChatMessages] to server."); - var _nc:ConnectionManager = BBB.initConnectionManager(); - _nc.sendMessage("chat.clearPublicChatMessages", - function(result:String):void { // On successful result - LOGGER.debug(result); }, function(status:String):void { // status - On error occurred LOGGER.error(status); - } + }, + JSON.stringify(message) + ); + } + + public function sendPublicMessage(cm:ChatMessageVO):void { + LOGGER.debug("Sending [chat.sendPublicMessage] to server. [{0}]", [cm.message]); + var message:Object = { + header: {name: "SendPublicMessagePubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()}, + body: {message: cm} + }; + + var _nc:ConnectionManager = BBB.initConnectionManager(); + _nc.sendMessage2x( + function(result:String):void { // On successful result + }, + function(status:String):void { // status - On error occurred + LOGGER.error(status); + }, + JSON.stringify(message) + ); + } + + public function sendPrivateMessage(cm:ChatMessageVO):void { + LOGGER.debug("Sending [chat.sendPrivateMessage] to server."); + LOGGER.debug("Sending fromUserID [{0}] to toUserID [{1}]", [cm.fromUserId, cm.toUserId]); + var message:Object = { + header: {name: "SendPrivateMessagePubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()}, + body: {message: cm} + }; + + var _nc:ConnectionManager = BBB.initConnectionManager(); + _nc.sendMessage2x( + function(result:String):void { // On successful result + }, + function(status:String):void { // status - On error occurred + LOGGER.error(status); + }, + JSON.stringify(message) + ); + } + + public function clearPublicChatMessages():void { + LOGGER.debug("Sending [chat.clearPublicChatMessages] to server."); + var message:Object = { + header: {name: "ClearPublicChatHistoryPubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()}, + body: {} + }; + + var _nc:ConnectionManager = BBB.initConnectionManager(); + _nc.sendMessage2x( + function(result:String):void { // On successful result + }, + function(status:String):void { // status - On error occurred + LOGGER.error(status); + }, + JSON.stringify(message) ); } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AddChatTabBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AddChatTabBox.mxml index 2453b3d685..682954b985 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AddChatTabBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AddChatTabBox.mxml @@ -103,15 +103,15 @@ with BigBlueButton; if not, see . if (!usersList.visible || !usersList.enabled) return; - var chatWithUserID:String = usersList.selectedItem.userID; + var chatWithIntId:String = usersList.selectedItem.intId; // Don't want to be chatting with ourself. - if (UsersUtil.isMe(chatWithUserID)) return; + if (UsersUtil.isMe(chatWithIntId)) return; usersList.selectedIndex = -1; var e:CoreEvent = new CoreEvent(EventConstants.START_PRIVATE_CHAT); - e.message.chatWith = chatWithUserID; + e.message.chatWith = chatWithIntId; var gd:Dispatcher = new Dispatcher(); gd.dispatchEvent(e); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AdvancedList.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AdvancedList.as index fcd7153cd0..bdf8f1279a 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AdvancedList.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/AdvancedList.as @@ -49,7 +49,7 @@ package org.bigbluebutton.modules.chat.views //sovled on forum by Flex HarUI measuredHeight = measureHeightOfItems() + viewMetrics.top + viewMetrics.bottom; - dispatchEvent(new ChatEvent(ChatEvent.RESIZE_CHAT_TOOLBAR)); + //dispatchEvent(new ChatEvent(ChatEvent.RESIZE_CHAT_TOOLBAR)); } public function scrollToBottom():void { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml index e1f7cd113f..8cebbd5232 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml @@ -52,6 +52,7 @@ with BigBlueButton; if not, see . + @@ -90,13 +91,13 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.chat.ChatConstants; import org.bigbluebutton.modules.chat.ChatUtil; import org.bigbluebutton.modules.chat.events.ChatEvent; + import org.bigbluebutton.modules.chat.events.ChatHistoryEvent; import org.bigbluebutton.modules.chat.events.ChatOptionsEvent; import org.bigbluebutton.modules.chat.events.ClearPublicChatEvent; import org.bigbluebutton.modules.chat.events.PrivateChatMessageEvent; import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent; import org.bigbluebutton.modules.chat.events.SendPrivateChatMessageEvent; import org.bigbluebutton.modules.chat.events.SendPublicChatMessageEvent; - import org.bigbluebutton.modules.chat.events.TranscriptEvent; import org.bigbluebutton.modules.chat.model.ChatConversation; import org.bigbluebutton.modules.chat.model.ChatOptions; import org.bigbluebutton.modules.chat.vo.ChatMessageVO; @@ -141,9 +142,6 @@ with BigBlueButton; if not, see . [Bindable] private var chatListHeight:Number = 100; - [Bindable] - private var chatToolbarHeight:Number = 80; - [Bindable] public var chatOptions:ChatOptions; private var shiftPressed:Boolean = false; @@ -270,7 +268,7 @@ with BigBlueButton; if not, see . private function loadChatHistory(event:TimerEvent):void { if (publicChat) { var disp:Dispatcher = new Dispatcher(); - disp.dispatchEvent(new TranscriptEvent(TranscriptEvent.LOAD_TRANSCRIPT)); + disp.dispatchEvent(new ChatHistoryEvent(ChatHistoryEvent.REQUEST_HISTORY)); } } @@ -301,13 +299,12 @@ with BigBlueButton; if not, see . private var SPACE:String = " "; private function displayUserHasLeftMessage():void { var msg:ChatMessageVO = new ChatMessageVO(); - msg.chatType = ChatConstants.PUBLIC_CHAT; - msg.fromUserID = SPACE; + msg.fromUserId = SPACE; msg.fromUsername = SPACE; msg.fromColor = "0"; msg.fromTime = new Date().getTime(); msg.fromTimezoneOffset = new Date().getTimezoneOffset(); - msg.toUserID = SPACE; + msg.toUserId = SPACE; msg.toUsername = SPACE; msg.message = ""+ResourceUtil.getInstance().getString('bbb.chat.private.userLeft')+""; @@ -316,13 +313,12 @@ with BigBlueButton; if not, see . private function displayUserHasJoinedMessage():void { var msg:ChatMessageVO = new ChatMessageVO(); - msg.chatType = ChatConstants.PUBLIC_CHAT; - msg.fromUserID = SPACE; + msg.fromUserId = SPACE; msg.fromUsername = SPACE; msg.fromColor = "0"; msg.fromTime = new Date().getTime(); msg.fromTimezoneOffset = new Date().getTimezoneOffset(); - msg.toUserID = SPACE; + msg.toUserId = SPACE; msg.toUsername = SPACE; msg.message = ""+ResourceUtil.getInstance().getString('bbb.chat.private.userJoined')+""; @@ -337,9 +333,14 @@ with BigBlueButton; if not, see . private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void { if (publicChat) { chatMessages.newChatMessage(event.message); - if (!event.history) { - scrollToEndOfMessage(); - } + scrollToEndOfMessage(); + } + } + + private function handleRecievedChatHistoryEvent(event:ChatHistoryEvent):void { + if (publicChat && event.history != null) { + chatMessages.processChatHistory(event.history); + scrollToEndOfMessage(); } } @@ -352,8 +353,8 @@ with BigBlueButton; if not, see . var message:ChatMessageVO = event.message; if (!publicChat && - ( (message.fromUserID == chatWithUserID && UsersUtil.isMe(message.toUserID)) || - (message.toUserID == chatWithUserID && UsersUtil.isMe(message.fromUserID)) )) { + ( (message.fromUserId == chatWithUserID && UsersUtil.isMe(message.toUserId)) || + (message.toUserId == chatWithUserID && UsersUtil.isMe(message.fromUserId)) )) { chatMessages.newChatMessage(event.message); scrollToEndOfMessage(); } @@ -368,13 +369,12 @@ with BigBlueButton; if not, see . var keyCombo:String = modifier + String.fromCharCode(int(ResourceUtil.getInstance().getString('bbb.shortcutkey.chat.closePrivate'))); var msg:ChatMessageVO = new ChatMessageVO(); - msg.chatType = ChatConstants.PUBLIC_CHAT; - msg.fromUserID = SPACE; + msg.fromUserId = SPACE; msg.fromUsername = SPACE; msg.fromColor = "0"; msg.fromTime = new Date().getTime(); msg.fromTimezoneOffset = new Date().getTimezoneOffset(); - msg.toUserID = SPACE; + msg.toUserId = SPACE; msg.toUsername = SPACE; msg.message = ""+ResourceUtil.getInstance().getString('bbb.chat.private.closeMessage', [keyCombo])+""; @@ -483,8 +483,7 @@ with BigBlueButton; if not, see . } 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.fromUserId = UsersUtil.getMyUserID(); cm.fromUsername = UsersUtil.getMyUsername(); // get the color value from ColorPicker cm.fromColor = cmpColorPicker.selectedColor.toString(); @@ -505,8 +504,7 @@ with BigBlueButton; if not, see . private function sendPrivateChatMessage(message:String):void { var privateEvent:SendPrivateChatMessageEvent = new SendPrivateChatMessageEvent(SendPrivateChatMessageEvent.SEND_PRIVATE_CHAT_MESSAGE_EVENT); var cm:ChatMessageVO = new ChatMessageVO(); - cm.chatType = ChatConstants.PRIVATE_CHAT; - cm.fromUserID = UsersUtil.getMyUserID(); + cm.fromUserId = UsersUtil.getMyUserID(); cm.fromUsername = UsersUtil.getMyUsername(); // get the color value from ColorPicker cm.fromColor = cmpColorPicker.selectedColor.toString(); @@ -519,7 +517,7 @@ with BigBlueButton; if not, see . //cm.message = ChatUtil.parseURLs(ChatUtil.cleanup(message)); cm.message = ExternalInterface.call('parseURLs', (ChatUtil.cleanup(message))); - cm.toUserID = chatWithUserID; + cm.toUserId = chatWithUserID; cm.toUsername = chatWithUsername; privateEvent.chatMessage = cm; @@ -645,17 +643,12 @@ with BigBlueButton; if not, see . const paddingHeight:int = 5; const paddingWidth:int = 5; - chatToolbar.width = 45; - chatToolbar.x = (chatMessagesCanvas.width - chatToolbar.width) - 10; + chatToolbar.x = (chatMessagesCanvas.width - chatToolbar.width) - 20; chatToolbar.y = 10; if (!publicChat) { chatToolbar.publicChat = false; } - - if(chatMessagesList.mx_internal::scroll_verticalScrollBar != null && chatMessagesList.mx_internal::scroll_verticalScrollBar.visible){ - chatToolbar.width -= chatMessagesList.mx_internal::scroll_verticalScrollBar.width; - } } ]]> diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatControlBar.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatControlBar.mxml deleted file mode 100755 index 9dadce3a3a..0000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatControlBar.mxml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml old mode 100644 new mode 100755 index f8aebeb044..3f58eba4bc --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatToolbar.mxml @@ -10,6 +10,7 @@ visible="{toolbarVisible}" styleName="chatToolbarStyle" horizontalAlign="center" + width="28" hideEffect="{fadeOut}" showEffect="{fadeIn}" backgroundColor="{bgColor}"> diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml index a7ee4f1ac9..cc15e440e3 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatView.mxml @@ -167,7 +167,7 @@ with BigBlueButton; if not, see . private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void { notifyUserOfNewMessage(PUBLIC_CHAT_USERID); - if (!UsersUtil.isMe(event.message.fromUserID)) { + if (!UsersUtil.isMe(event.message.fromUserId)) { publicNotification(); } } @@ -175,17 +175,17 @@ with BigBlueButton; if not, see . 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; + 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)) { + if (! userHasChatBox(event.message.fromUserId)) { // Open a private chat tab. - openChatBoxFor(event.message.fromUserID, false).handleFirstPrivateMessage(event); + openChatBoxFor(event.message.fromUserId, false).handleFirstPrivateMessage(event); } // See if the chatbox is not in focus and notify user about the message. - notifyUserOfNewMessage(event.message.fromUserID); + notifyUserOfNewMessage(event.message.fromUserId); privateNotification(event); } @@ -344,7 +344,7 @@ with BigBlueButton; if not, see . // Activates an audio alert for screen-reader users on private message reception private function privateNotification(event:PrivateChatMessageEvent):void{ - if (! UsersUtil.isMe(event.message.fromUserID)) { + if (! UsersUtil.isMe(event.message.fromUserId)) { playSound(); } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/UserRenderer.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/UserRenderer.mxml index ff76590ac0..091b6cf9f6 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/UserRenderer.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/UserRenderer.mxml @@ -26,7 +26,13 @@ with BigBlueButton; if not, see . import org.bigbluebutton.util.i18n.ResourceUtil; ]]> + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/vo/ChatMessageVO.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/vo/ChatMessageVO.as index 2487b75b5d..15e4a1d8f2 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/vo/ChatMessageVO.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/vo/ChatMessageVO.as @@ -18,41 +18,22 @@ */ package org.bigbluebutton.modules.chat.vo { - public class ChatMessageVO { - // The type of chat (PUBLIC or PRIVATE) - public var chatType:String; - + public class ChatMessageVO { // The sender - public var fromUserID:String; + public var fromUserId:String; public var fromUsername:String; public var fromColor:String; // Store the UTC time when the message was sent. - public var fromTime:Number; + public var fromTime:Number; // Stores the timezone offset (in minutes) when the message was // sent. This is used by the receiver to convert to locale time. public var fromTimezoneOffset:Number; // The receiver. - public var toUserID:String = "public_chat_userid"; + public var toUserId:String = "public_chat_userid"; public var toUsername:String = "public_chat_username"; - public var message:String; - - public function toObj():Object { - var m:Object = new Object(); - m.chatType = chatType; - m.fromUserID = fromUserID; - m.fromUsername = fromUsername; - m.fromColor = fromColor; - m.fromTime = fromTime; - m.fromTimezoneOffset = fromTimezoneOffset; - m.message = message; - m.toUserID = toUserID; - m.toUsername = toUsername; - - return m; - } - - } + public var message:String; + } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollDataProcessor.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollDataProcessor.as index 62d1b2018f..9d9b24c560 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollDataProcessor.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollDataProcessor.as @@ -84,19 +84,17 @@ package org.bigbluebutton.modules.polling.service } var pollResultMessage:ChatMessageVO = new ChatMessageVO(); - pollResultMessage.chatType = ChatConstants.PUBLIC_CHAT; - pollResultMessage.fromUserID = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage"); + pollResultMessage.fromUserId = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage"); pollResultMessage.fromUsername = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage"); pollResultMessage.fromColor = "86187"; pollResultMessage.fromTime = new Date().getTime(); pollResultMessage.fromTimezoneOffset = new Date().getTimezoneOffset(); - pollResultMessage.toUserID = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage"); + pollResultMessage.toUserId = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage"); pollResultMessage.toUsername = ResourceUtil.getInstance().getString("bbb.chat.chatMessage.systemMessage"); pollResultMessage.message = accessibleAnswers; var pollResultMessageEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT); pollResultMessageEvent.message = pollResultMessage; - pollResultMessageEvent.history = false; dispatcher.dispatchEvent(pollResultMessageEvent); } } From bf9f6df9b1edd7466fe899286558ff82a5d9e901 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Fri, 7 Jul 2017 20:16:14 -0400 Subject: [PATCH 25/28] remove all 1.1 chat messaging code --- .../core/api/IBigBlueButtonInGW.java | 7 - .../pubsub/receivers/ChatMessageReceiver.java | 49 ------- .../receivers/RedisMessageReceiver.java | 3 - .../core/BigBlueButtonActor.scala | 2 +- .../core/BigBlueButtonInGW.scala | 27 ---- .../core/MessageSenderActor.scala | 25 ---- .../bigbluebutton/core/api/InMessages.scala | 7 +- .../bigbluebutton/core/api/OutMessages.scala | 9 -- .../org/bigbluebutton/core/apps/ChatApp.scala | 36 ----- .../senders/ChatMessageToJsonConverter.scala | 72 ---------- .../core/running/MeetingActor.scala | 6 +- .../endpoint/redis/RedisRecorderActor.scala | 12 +- .../red5/client/ChatClientMessageSender.java | 135 ------------------ .../red5/client/ChatKeyUtil.java | 13 -- .../common/messages/ChatKeyUtil.java | 13 -- .../ClearPublicChatHistoryReplyMessage.java | 51 ------- .../ClearPublicChatHistoryRequestMessage.java | 52 ------- .../common/messages/GetChatHistory.java | 57 -------- .../messages/GetChatHistoryReplyMessage.java | 65 --------- .../GetChatHistoryRequestMessage.java | 56 -------- .../common/messages/MessagingConstants.java | 2 - .../messages/SendPrivateChatMessage.java | 115 --------------- .../messages/SendPublicChatMessage.java | 115 --------------- .../bigbluebutton/common/messages/Util.java | 42 ------ .../red5/pubsub/MessagePublisher.java | 20 --- .../redis/RedisPubSubMessageHandler.java | 7 +- .../red5/service/ChatKeyUtil.java | 13 -- .../red5/service/ChatService.java | 132 ----------------- .../src/main/webapp/WEB-INF/red5-web.xml | 5 - 29 files changed, 10 insertions(+), 1138 deletions(-) delete mode 100755 akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java delete mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala delete mode 100755 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala delete mode 100755 bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java delete mode 100755 bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatKeyUtil.java delete mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ChatKeyUtil.java delete mode 100644 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryReplyMessage.java delete mode 100644 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryRequestMessage.java delete mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java delete mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java delete mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java delete mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java delete mode 100755 bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatKeyUtil.java delete mode 100755 bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java 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 7d5526d16e..f6ff6178ce 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 @@ -102,13 +102,6 @@ public interface IBigBlueButtonInGW { boolean lock, boolean viewersOnly, String layout); - // Chat - void getAllChatHistory(String meetingID, String requesterID, String replyTo); - void getChatHistory(String meetingID, String requesterID, String replyTo, String chatId); - void sendPublicMessage(String meetingID, String requesterID, Map message); - void sendPrivateMessage(String meetingID, String requesterID, Map message); - void clearPublicChatHistory(String meetingID, String requesterID); - // DeskShare void deskShareStarted(String confId, String callerId, String callerIdName); void deskShareStopped(String conferenceName, String callerId, String callerIdName); diff --git a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java deleted file mode 100755 index 709111a818..0000000000 --- a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/ChatMessageReceiver.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.bigbluebutton.core.pubsub.receivers; - -import org.bigbluebutton.common.messages.GetChatHistoryRequestMessage; -import org.bigbluebutton.common.messages.MessagingConstants; -import org.bigbluebutton.common.messages.SendPrivateChatMessage; -import org.bigbluebutton.common.messages.SendPublicChatMessage; -import org.bigbluebutton.common.messages.ClearPublicChatHistoryRequestMessage; - -import com.google.gson.JsonParser; -import com.google.gson.JsonObject; - -import org.bigbluebutton.core.api.IBigBlueButtonInGW; - -public class ChatMessageReceiver implements MessageHandler{ - - private IBigBlueButtonInGW bbbGW; - - public ChatMessageReceiver(IBigBlueButtonInGW bbbGW) { - this.bbbGW = bbbGW; - } - - @Override - public void handleMessage(String pattern, String channel, String message) { - if (channel.equalsIgnoreCase(MessagingConstants.TO_CHAT_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 (GetChatHistoryRequestMessage.GET_CHAT_HISTORY_REQUEST.equals(messageName)) { - GetChatHistoryRequestMessage msg = GetChatHistoryRequestMessage.fromJson(message); - // TODO: Add chatId to getChatHistory message - bbbGW.getChatHistory(msg.meetingId, msg.requesterId, msg.replyTo, "FIXME!"); - } else if (SendPublicChatMessage.SEND_PUBLIC_CHAT_MESSAGE.equals(messageName)){ - SendPublicChatMessage msg = SendPublicChatMessage.fromJson(message); - bbbGW.sendPublicMessage(msg.meetingId, msg.requesterId, msg.messageInfo); - } else if (SendPrivateChatMessage.SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)){ - SendPrivateChatMessage msg = SendPrivateChatMessage.fromJson(message); - bbbGW.sendPrivateMessage(msg.meetingId, msg.requesterId, msg.messageInfo); - } else if (ClearPublicChatHistoryRequestMessage.CLEAR_PUBLIC_CHAT_HISTORY_REQUEST.equals(messageName)){ - ClearPublicChatHistoryRequestMessage msg = ClearPublicChatHistoryRequestMessage.fromJson(message); - bbbGW.clearPublicChatHistory(msg.meetingId, msg.requesterId); - } - } - } - } - } -} diff --git a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java index 60ae42b1f5..414460872a 100755 --- a/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java +++ b/akka-bbb-apps/src/main/java/org/bigbluebutton/core/pubsub/receivers/RedisMessageReceiver.java @@ -31,9 +31,6 @@ public class RedisMessageReceiver { } private void setupReceivers() { - ChatMessageReceiver chatRx = new ChatMessageReceiver(bbbGW); - receivers.add(chatRx); - LockMessageReceiver lockRx = new LockMessageReceiver(bbbGW); receivers.add(lockRx); diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala index 485db97a82..0ebd7ecaa6 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -314,7 +314,7 @@ class BigBlueButtonActor(val system: ActorSystem, eventBus.publish(BigBlueButtonEvent(id, new GetPresentationInfo(id, html5clientRequesterID, html5clientRequesterID))) //send chat history - eventBus.publish(BigBlueButtonEvent(id, new GetAllChatHistoryRequest(id, html5clientRequesterID, html5clientRequesterID))) + //eventBus.publish(BigBlueButtonEvent(id, new GetAllChatHistoryRequest(id, html5clientRequesterID, html5clientRequesterID))) //send lock settings eventBus.publish(BigBlueButtonEvent(id, new GetLockSettings(id, html5clientRequesterID))) 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 08b7638bfb..113fb34f0c 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 @@ -412,33 +412,6 @@ class BigBlueButtonInGW( } - /** - * ******************************************************************* - * Message Interface for Chat - * ***************************************************************** - */ - - def getAllChatHistory(meetingID: String, requesterID: String, replyTo: String) { - eventBus.publish(BigBlueButtonEvent(meetingID, new GetAllChatHistoryRequest(meetingID, requesterID, replyTo))) - } - - def getChatHistory(meetingID: String, requesterID: String, replyTo: String, chatId: String) { - eventBus.publish(BigBlueButtonEvent(meetingID, new GetChatHistoryRequest(meetingID, requesterID, replyTo, chatId))) - } - - def sendPublicMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { - // Convert java Map to Scala Map, then convert Mutable map to immutable map - eventBus.publish(BigBlueButtonEvent(meetingID, new SendPublicMessageRequest(meetingID, requesterID, JavaConverters.mapAsScalaMap(message).toMap))) - } - - def sendPrivateMessage(meetingID: String, requesterID: String, message: java.util.Map[String, String]) { - eventBus.publish(BigBlueButtonEvent(meetingID, new SendPrivateMessageRequest(meetingID, requesterID, JavaConverters.mapAsScalaMap(message).toMap))) - } - - def clearPublicChatHistory(meetingID: String, requesterID: String) { - eventBus.publish(BigBlueButtonEvent(meetingID, new ClearPublicChatHistoryRequest(meetingID, requesterID))) - } - /** * ******************************************************************* * Message Interface for Voice diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala index 70022382c5..439efdb37f 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/MessageSenderActor.scala @@ -8,7 +8,6 @@ import akka.actor.SupervisorStrategy.Resume import java.io.{ PrintWriter, StringWriter } import org.bigbluebutton.core.api._ import org.bigbluebutton.common.messages.MessagingConstants -import org.bigbluebutton.core.pubsub.senders.ChatMessageToJsonConverter import org.bigbluebutton.common.messages.StartRecordingVoiceConfRequestMessage import org.bigbluebutton.common.messages.StopRecordingVoiceConfRequestMessage import org.bigbluebutton.core.pubsub.senders.MeetingMessageToJsonConverter @@ -55,10 +54,6 @@ class MessageSenderActor(val service: MessageSender) val encoder = new ToJsonEncoder() def receive = { case msg: UserEjectedFromMeeting => handleUserEjectedFromMeeting(msg) - case msg: GetChatHistoryReply => handleGetChatHistoryReply(msg) - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case msg: SendPrivateMessageEvent => handleSendPrivateMessageEvent(msg) - case msg: ClearPublicChatHistoryReply => handleClearPublicChatHistoryReply(msg) case msg: MeetingCreated => handleMeetingCreated(msg) case msg: VoiceRecordingStarted => handleVoiceRecordingStarted(msg) case msg: VoiceRecordingStopped => handleVoiceRecordingStopped(msg) @@ -178,26 +173,6 @@ class MessageSenderActor(val service: MessageSender) service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, json) } - private def handleGetChatHistoryReply(msg: GetChatHistoryReply) { - val json = ChatMessageToJsonConverter.getChatHistoryReplyToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { - val json = ChatMessageToJsonConverter.sendPublicMessageEventToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - - private def handleSendPrivateMessageEvent(msg: SendPrivateMessageEvent) { - val json = ChatMessageToJsonConverter.sendPrivateMessageEventToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - - private def handleClearPublicChatHistoryReply(msg: ClearPublicChatHistoryReply) { - val json = ChatMessageToJsonConverter.clearPublicChatHistoryReplyToJson(msg) - service.send(MessagingConstants.FROM_CHAT_CHANNEL, json) - } - private def handleStartRecordingVoiceConf(msg: StartRecordingVoiceConf) { val m = new StartRecordingVoiceConfRequestMessage(msg.meetingID, msg.voiceConfId) service.send(MessagingConstants.TO_VOICE_CONF_SYSTEM_CHAN, m.toJson()) 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 9e4b92505f..8cf0587716 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 @@ -94,14 +94,9 @@ case class ActivityResponse(meetingID: String) extends InMessage case class LogoutEndMeeting(meetingID: String, userID: String) extends InMessage ////////////////////////////////////////////////////////////////////////////////// -// Chat +// Global Audio ///////////////////////////////////////////////////////////////////////////////// -case class GetAllChatHistoryRequest(meetingID: String, requesterID: String, replyTo: String) extends InMessage -case class GetChatHistoryRequest(meetingID: String, requesterID: String, replyTo: String, chatId: String) extends InMessage -case class SendPublicMessageRequest(meetingID: String, requesterID: String, message: Map[String, String]) extends InMessage -case class SendPrivateMessageRequest(meetingID: String, requesterID: String, message: Map[String, String]) extends InMessage -case class ClearPublicChatHistoryRequest(meetingID: String, requesterID: String) extends InMessage case class UserConnectedToGlobalAudio(meetingID: String, /** Not used. Just to satisfy trait **/ voiceConf: String, userid: String, name: String) extends InMessage case class UserDisconnectedFromGlobalAudio(meetingID: String, /** Not used. Just to satisfy trait **/ voiceConf: String, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala index 8ad8ed9e45..7b24d1f2ce 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala @@ -80,15 +80,6 @@ case class StartRecordingVoiceConf(meetingID: String, recorded: Boolean, voiceCo case class StopRecordingVoiceConf(meetingID: String, recorded: Boolean, voiceConfId: String, recordedStream: String) extends IOutMessage case class StopRecording(meetingID: String, recorded: Boolean, requesterID: String) extends IOutMessage -// Chat -case class GetChatHistoryReply(meetingID: String, recorded: Boolean, requesterID: String, - replyTo: String, history: Array[Map[String, String]]) extends IOutMessage -case class SendPublicMessageEvent(meetingID: String, recorded: Boolean, requesterID: String, - message: Map[String, String]) extends IOutMessage -case class SendPrivateMessageEvent(meetingID: String, recorded: Boolean, requesterID: String, - message: Map[String, String]) extends IOutMessage -case class ClearPublicChatHistoryReply(meetingID: String, recorded: Boolean, requesterID: String) extends IOutMessage - // Layout case class GetCurrentLayoutReply(meetingID: String, recorded: Boolean, requesterID: String, layoutID: String, locked: Boolean, setByUserID: String) extends IOutMessage diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala deleted file mode 100755 index 400a4b210d..0000000000 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ChatApp.scala +++ /dev/null @@ -1,36 +0,0 @@ -package org.bigbluebutton.core.apps - -import org.bigbluebutton.common2.domain.DefaultProps -import org.bigbluebutton.core.api._ -import org.bigbluebutton.core.running.LiveMeeting -import org.bigbluebutton.core.{ OutMessageGateway } - -trait ChatApp { - - val props: DefaultProps - val liveMeeting: LiveMeeting - val outGW: OutMessageGateway - - def handleGetChatHistoryRequest(msg: GetChatHistoryRequest) { - //val history = liveMeeting.chatModel.getChatHistory() - //outGW.send(new GetChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID, msg.replyTo, history)) - } - - def handleSendPublicMessageRequest(msg: SendPublicMessageRequest) { - //liveMeeting.chatModel.addNewChatMessage(msg.message) - val pubMsg = msg.message - - outGW.send(new SendPublicMessageEvent(props.meetingProp.intId, props.recordProp.record, msg.requesterID, pubMsg)) - } - - def handleSendPrivateMessageRequest(msg: SendPrivateMessageRequest) { - val privMsg = msg.message - outGW.send(new SendPrivateMessageEvent(props.meetingProp.intId, props.recordProp.record, msg.requesterID, privMsg)) - } - - def handleClearPublicChatHistoryRequest(msg: ClearPublicChatHistoryRequest) { - //liveMeeting.chatModel.clearPublicChatHistory() - outGW.send(new ClearPublicChatHistoryReply(props.meetingProp.intId, props.recordProp.record, msg.requesterID)) - } - -} \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala deleted file mode 100755 index 2a6784ee79..0000000000 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ChatMessageToJsonConverter.scala +++ /dev/null @@ -1,72 +0,0 @@ -package org.bigbluebutton.core.pubsub.senders - -import org.bigbluebutton.core.api._ -import scala.collection.mutable.HashMap -import java.util.ArrayList -import org.bigbluebutton.core.messaging.Util -import org.bigbluebutton.common.messages.ChatKeyUtil -import scala.collection.JavaConverters - -object ChatMessageToJsonConverter { - - val UNKNOWN = "unknown" - - private def chatMessageToMap(msg: Map[String, String]): HashMap[String, String] = { - val res = new HashMap[String, String] - res += "chat_type" -> msg.get(ChatKeyUtil.CHAT_TYPE).getOrElse(UNKNOWN) - res += "from_userid" -> msg.get(ChatKeyUtil.FROM_USERID).getOrElse(UNKNOWN) - res += "from_username" -> msg.get(ChatKeyUtil.FROM_USERNAME).getOrElse(UNKNOWN) - res += "from_color" -> msg.get(ChatKeyUtil.FROM_COLOR).getOrElse(UNKNOWN) - res += "from_time" -> msg.get(ChatKeyUtil.FROM_TIME).getOrElse(UNKNOWN) - res += "from_tz_offset" -> msg.get(ChatKeyUtil.FROM_TZ_OFFSET).getOrElse(UNKNOWN) - res += "to_userid" -> msg.get(ChatKeyUtil.TO_USERID).getOrElse(UNKNOWN) - res += "to_username" -> msg.get(ChatKeyUtil.TO_USERNAME).getOrElse(UNKNOWN) - res += "message" -> msg.get(ChatKeyUtil.MESSAGE).getOrElse(UNKNOWN) - - res - } - - def getChatHistoryReplyToJson(msg: GetChatHistoryReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val collection = new ArrayList[java.util.Map[String, String]](); - - msg.history.foreach(p => { - collection.add(JavaConverters.mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(p))) - }) - - payload.put(Constants.CHAT_HISTORY, collection) - - val header = Util.buildHeader(MessageNames.GET_CHAT_HISTORY_REPLY, Some(msg.replyTo)) - Util.buildJson(header, payload) - } - - def sendPublicMessageEventToJson(msg: SendPublicMessageEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE, JavaConverters.mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) - - val header = Util.buildHeader(MessageNames.SEND_PUBLIC_CHAT_MESSAGE, None) - Util.buildJson(header, payload) - } - - def sendPrivateMessageEventToJson(msg: SendPrivateMessageEvent): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.MESSAGE, JavaConverters.mapAsJavaMap(ChatMessageToJsonConverter.chatMessageToMap(msg.message))) - - val header = Util.buildHeader(MessageNames.SEND_PRIVATE_CHAT_MESSAGE, None) - Util.buildJson(header, payload) - } - - def clearPublicChatHistoryReplyToJson(msg: ClearPublicChatHistoryReply): String = { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = Util.buildHeader(MessageNames.CLEAR_PUBLIC_CHAT_HISTORY_REPLY, None) - Util.buildJson(header, payload) - } -} \ No newline at end of file diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index feff4f7592..6625877043 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -49,7 +49,7 @@ class MeetingActor(val props: DefaultProps, with BreakoutApp2x with UsersApp with PresentationApp - with ChatApp with WhiteboardApp with PollApp + with WhiteboardApp with PollApp with BreakoutRoomApp with PermisssionCheck with UserBroadcastCamStartMsgHdlr @@ -138,9 +138,6 @@ class MeetingActor(val props: DefaultProps, case msg: MuteUserRequest => handleMuteUserRequest(msg) case msg: EjectUserFromVoiceRequest => handleEjectUserRequest(msg) case msg: TransferUserToMeetingRequest => handleTransferUserToMeeting(msg) - case msg: GetChatHistoryRequest => handleGetChatHistoryRequest(msg) - case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) - case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg) case msg: InitializeMeeting => handleInitializeMeeting(msg) @@ -148,7 +145,6 @@ class MeetingActor(val props: DefaultProps, case msg: GetRecordingStatus => handleGetRecordingStatus(msg) case msg: GetPollRequest => handleGetPollRequest(msg) case msg: LogoutEndMeeting => handleLogoutEndMeeting(msg) - case msg: ClearPublicChatHistoryRequest => handleClearPublicChatHistoryRequest(msg) // Breakout rooms case msg: BreakoutRoomsListMessage => handleBreakoutRoomsList(msg) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala index ea25fa2c29..1b42ed33e7 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala @@ -38,8 +38,8 @@ class RedisRecorderActor(val system: ActorSystem) } def receive = { - case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) - case msg: ClearPublicChatHistoryReply => handleClearPublicChatHistoryReply(msg) + //case msg: SendPublicMessageEvent => handleSendPublicMessageEvent(msg) + //case msg: ClearPublicChatHistoryReply => handleClearPublicChatHistoryReply(msg) case msg: ClearPresentationOutMsg => handleClearPresentationOutMsg(msg) case msg: RemovePresentationOutMsg => handleRemovePresentationOutMsg(msg) case msg: ResizeAndMoveSlideOutMsg => handleResizeAndMoveSlideOutMsg(msg) @@ -71,7 +71,7 @@ class RedisRecorderActor(val system: ActorSystem) case _ => // do nothing } - private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { + /* private def handleSendPublicMessageEvent(msg: SendPublicMessageEvent) { if (msg.recorded) { val message = JavaConverters.mapAsJavaMap(msg.message) val ev = new PublicChatRecordEvent() @@ -85,16 +85,16 @@ class RedisRecorderActor(val system: ActorSystem) record(msg.meetingID, JavaConverters.mapAsScalaMap(ev.toMap).toMap) } - } + }*/ - private def handleClearPublicChatHistoryReply(msg: ClearPublicChatHistoryReply) { + /* private def handleClearPublicChatHistoryReply(msg: ClearPublicChatHistoryReply) { if (msg.recorded) { val ev = new ClearPublicChatRecordEvent() ev.setTimestamp(TimestampGenerator.generateTimestamp()) ev.setMeetingId(msg.meetingID) record(msg.meetingID, JavaConverters.mapAsScalaMap(ev.toMap).toMap) } - } + }*/ private def handleClearPresentationOutMsg(msg: ClearPresentationOutMsg) { diff --git a/bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java b/bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java deleted file mode 100755 index fb5ad6ecee..0000000000 --- a/bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatClientMessageSender.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.bigbluebutton.red5.client; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import org.bigbluebutton.common.messages.ClearPublicChatHistoryReplyMessage; -import org.bigbluebutton.common.messages.GetChatHistoryReplyMessage; -import org.bigbluebutton.common.messages.SendPrivateChatMessage; -import org.bigbluebutton.common.messages.SendPublicChatMessage; -import org.bigbluebutton.red5.client.messaging.BroadcastClientMessage; -import org.bigbluebutton.red5.client.messaging.IConnectionInvokerService; -import org.bigbluebutton.red5.client.messaging.DirectClientMessage; -import org.bigbluebutton.red5.client.ChatKeyUtil; - -import java.util.HashMap; -import java.util.Map; - -public class ChatClientMessageSender { - private IConnectionInvokerService service; - - public ChatClientMessageSender(IConnectionInvokerService service) { - this.service = service; - } - - public void handleChatMessage(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 SendPublicChatMessage.SEND_PUBLIC_CHAT_MESSAGE: - SendPublicChatMessage spucm = SendPublicChatMessage.fromJson(message); - - if (spucm != null) { - processSendPublicChatMessage(spucm); - } - break; - case SendPrivateChatMessage.SEND_PRIVATE_CHAT_MESSAGE: - SendPrivateChatMessage sprcm = SendPrivateChatMessage.fromJson(message); - - if (sprcm != null) { - processSendPrivateChatMessage(sprcm); - } - break; - case GetChatHistoryReplyMessage.GET_CHAT_HISTORY_REPLY: - GetChatHistoryReplyMessage gch = GetChatHistoryReplyMessage.fromJson(message); - - if (gch != null) { - processGetChatHistoryReply(gch); - } - break; - case ClearPublicChatHistoryReplyMessage.CLEAR_PUBLIC_CHAT_HISTORY_REPLY: - ClearPublicChatHistoryReplyMessage gcl = ClearPublicChatHistoryReplyMessage.fromJson(message); - - if (gcl != null) { - processClearPublicChatHistoryReply(gcl); - } - break; - } - } - } - } - - - private void processSendPublicChatMessage(SendPublicChatMessage msg) { - Map messageInfo = new HashMap(); - messageInfo.put(ChatKeyUtil.CHAT_TYPE, msg.messageInfo.get(ChatKeyUtil.CHAT_TYPE)); - messageInfo.put(ChatKeyUtil.FROM_USERID, msg.messageInfo.get(ChatKeyUtil.FROM_USERID)); - messageInfo.put(ChatKeyUtil.FROM_USERNAME, msg.messageInfo.get(ChatKeyUtil.FROM_USERNAME)); - messageInfo.put(ChatKeyUtil.TO_USERID, msg.messageInfo.get(ChatKeyUtil.TO_USERID)); - messageInfo.put(ChatKeyUtil.TO_USERNAME, msg.messageInfo.get(ChatKeyUtil.TO_USERNAME)); - messageInfo.put(ChatKeyUtil.FROM_TIME, msg.messageInfo.get(ChatKeyUtil.FROM_TIME)); - messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msg.messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET)); - messageInfo.put(ChatKeyUtil.FROM_COLOR, msg.messageInfo.get(ChatKeyUtil.FROM_COLOR)); - messageInfo.put(ChatKeyUtil.MESSAGE, msg.messageInfo.get(ChatKeyUtil.MESSAGE)); - - BroadcastClientMessage m = new BroadcastClientMessage(msg.meetingId, "ChatReceivePublicMessageCommand", messageInfo); - service.sendMessage(m); - } - - private void processSendPrivateChatMessage(SendPrivateChatMessage msg) { - Map messageInfo = new HashMap(); - messageInfo.put(ChatKeyUtil.CHAT_TYPE, msg.messageInfo.get(ChatKeyUtil.CHAT_TYPE)); - messageInfo.put(ChatKeyUtil.FROM_USERID, msg.messageInfo.get(ChatKeyUtil.FROM_USERID)); - messageInfo.put(ChatKeyUtil.FROM_USERNAME, msg.messageInfo.get(ChatKeyUtil.FROM_USERNAME)); - messageInfo.put(ChatKeyUtil.TO_USERID, msg.messageInfo.get(ChatKeyUtil.TO_USERID)); - messageInfo.put(ChatKeyUtil.TO_USERNAME, msg.messageInfo.get(ChatKeyUtil.TO_USERNAME)); - messageInfo.put(ChatKeyUtil.FROM_TIME, msg.messageInfo.get(ChatKeyUtil.FROM_TIME)); - messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msg.messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET)); - messageInfo.put(ChatKeyUtil.FROM_COLOR, msg.messageInfo.get(ChatKeyUtil.FROM_COLOR)); - messageInfo.put(ChatKeyUtil.MESSAGE, msg.messageInfo.get(ChatKeyUtil.MESSAGE)); - - String toUserId = msg.messageInfo.get(ChatKeyUtil.TO_USERID); - DirectClientMessage receiver = new DirectClientMessage(msg.meetingId, toUserId, "ChatReceivePrivateMessageCommand", messageInfo); - service.sendMessage(receiver); - - DirectClientMessage sender = new DirectClientMessage(msg.meetingId, msg.requesterId, "ChatReceivePrivateMessageCommand", messageInfo); - service.sendMessage(sender); - } - - private void processGetChatHistoryReply(GetChatHistoryReplyMessage gch) { - - Map args = new HashMap(); - args.put("meetingId", gch.meetingId); - args.put("requester_id", gch.requesterId); - args.put("chat_history", gch.chatHistory); - - Map message = new HashMap(); - Gson gson = new Gson(); - message.put("msg", gson.toJson(args.get("chat_history"))); - - DirectClientMessage m = new DirectClientMessage(gch.meetingId, gch.requesterId, "ChatRequestMessageHistoryReply", message); - service.sendMessage(m); - } - - private void processClearPublicChatHistoryReply(ClearPublicChatHistoryReplyMessage gcl) { - - Map args = new HashMap(); - args.put("meetingId", gcl.meetingId); - args.put("requester_id", gcl.requesterId); - - Map message = new HashMap(); - Gson gson = new Gson(); - message.put("msg", gson.toJson(args)); - - BroadcastClientMessage m = new BroadcastClientMessage(gcl.meetingId, "ChatClearPublicMessageCommand", message); - service.sendMessage(m); - } - -} diff --git a/bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatKeyUtil.java b/bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatKeyUtil.java deleted file mode 100755 index b27a313e39..0000000000 --- a/bbb-apps-common/src/main/java/org/bigbluebutton/red5/client/ChatKeyUtil.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.red5.client; - -public class ChatKeyUtil { - public static final String CHAT_TYPE = "chatType"; - public static final String FROM_USERID = "fromUserID"; - public static final String FROM_USERNAME = "fromUsername"; - public static final String FROM_COLOR = "fromColor"; - public static final String FROM_TIME = "fromTime"; - public static final String FROM_TZ_OFFSET = "fromTimezoneOffset"; - public static final String TO_USERID = "toUserID"; - public static final String TO_USERNAME = "toUsername"; - public static final String MESSAGE = "message"; -} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ChatKeyUtil.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ChatKeyUtil.java deleted file mode 100755 index 97d1f403f6..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ChatKeyUtil.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.common.messages; - -public class ChatKeyUtil { - public static final String CHAT_TYPE = "chatType"; - public static final String FROM_USERID = "fromUserID"; - public static final String FROM_USERNAME = "fromUsername"; - public static final String FROM_COLOR = "fromColor"; - public static final String FROM_TIME = "fromTime"; - public static final String FROM_TZ_OFFSET = "fromTimezoneOffset"; - public static final String TO_USERID = "toUserID"; - public static final String TO_USERNAME = "toUsername"; - public static final String MESSAGE = "message"; -} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryReplyMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryReplyMessage.java deleted file mode 100644 index db558327e6..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryReplyMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.bigbluebutton.common.messages; - -import java.util.HashMap; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class ClearPublicChatHistoryReplyMessage implements ISubscribedMessage { - public static final String CLEAR_PUBLIC_CHAT_HISTORY_REPLY = "clear_public_chat_history_reply"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - public final String requesterId; - - - public ClearPublicChatHistoryReplyMessage(String meetingId, String requesterId) { - this.meetingId = meetingId; - this.requesterId = requesterId; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.MEETING_ID, meetingId); - payload.put(Constants.REQUESTER_ID, requesterId); - - java.util.HashMap header = MessageBuilder.buildHeader(CLEAR_PUBLIC_CHAT_HISTORY_REPLY, VERSION, null); - return MessageBuilder.buildJson(header, payload); - } - - public static ClearPublicChatHistoryReplyMessage fromJson(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"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (CLEAR_PUBLIC_CHAT_HISTORY_REPLY.equals(messageName)) { - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.REQUESTER_ID)) { - String meetingId = payload.get(Constants.MEETING_ID).getAsString(); - String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); - - return new ClearPublicChatHistoryReplyMessage(meetingId, requesterId); - } - } - } - } - return null; - } -} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryRequestMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryRequestMessage.java deleted file mode 100644 index 8cee18bdbf..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/ClearPublicChatHistoryRequestMessage.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.bigbluebutton.common.messages; - -import java.util.HashMap; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class ClearPublicChatHistoryRequestMessage implements IBigBlueButtonMessage { - public static final String CLEAR_PUBLIC_CHAT_HISTORY_REQUEST = "clear_public_chat_history_request"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - public final String requesterId; - - - public ClearPublicChatHistoryRequestMessage(String meetingId, String requesterId) { - this.meetingId = meetingId; - this.requesterId = requesterId; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.MEETING_ID, meetingId); - payload.put(Constants.REQUESTER_ID, requesterId); - - java.util.HashMap header = MessageBuilder.buildHeader(CLEAR_PUBLIC_CHAT_HISTORY_REQUEST, VERSION, null); - return MessageBuilder.buildJson(header, payload); - } - - public static ClearPublicChatHistoryRequestMessage fromJson(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"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (CLEAR_PUBLIC_CHAT_HISTORY_REQUEST.equals(messageName)) { - - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.REQUESTER_ID)) { - String meetingId = payload.get(Constants.MEETING_ID).getAsString(); - String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); - - return new ClearPublicChatHistoryRequestMessage(meetingId, requesterId); - } - } - } - } - return null; - } -} 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 deleted file mode 100755 index 36390c3e04..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistory.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.bigbluebutton.common.messages; - -import java.util.HashMap; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -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"; - - public final String meetingId; - public final String replyTo; - public final String requesterId; - - - public GetChatHistory(String meetingId, String requesterId, String replyTo) { - this.meetingId = meetingId; - this.replyTo = replyTo; - this.requesterId = requesterId; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.MEETING_ID, meetingId); - payload.put(Constants.REPLY_TO, replyTo); - payload.put(Constants.REQUESTER_ID, requesterId); - - java.util.HashMap header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null); - return MessageBuilder.buildJson(header, payload); - } - - public static GetChatHistory fromJson(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"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (GET_CHAT_HISTORY_REQUEST.equals(messageName)) { - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.REPLY_TO) - && payload.has(Constants.REQUESTER_ID)) { - String meetingId = payload.get(Constants.MEETING_ID).getAsString(); - String replyTo = payload.get(Constants.REPLY_TO).getAsString(); - String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); - return new GetChatHistory(meetingId, replyTo, requesterId); - } - } - } - } - return null; - } -} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java deleted file mode 100755 index b7a4203cfc..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryReplyMessage.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.bigbluebutton.common.messages; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -public class GetChatHistoryReplyMessage implements ISubscribedMessage { - public static final String GET_CHAT_HISTORY_REPLY = "get_chat_history_reply"; - public static final String VERSION = "0.0.1"; - - public final String meetingId; - public final String requesterId; - public final ArrayList> chatHistory; - - - public GetChatHistoryReplyMessage(String meetingId, String requesterId, ArrayList> chatHistory) { - this.meetingId = meetingId; - this.chatHistory = chatHistory; - this.requesterId = requesterId; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.MEETING_ID, meetingId); - payload.put(Constants.CHAT_HISTORY, chatHistory); - payload.put(Constants.REQUESTER_ID, requesterId); - - java.util.HashMap header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REPLY, VERSION, null); - return MessageBuilder.buildJson(header, payload); - } - - public static GetChatHistoryReplyMessage fromJson(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"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (GET_CHAT_HISTORY_REPLY.equals(messageName)) { - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.CHAT_HISTORY) - && payload.has(Constants.REQUESTER_ID)) { - String meetingId = payload.get(Constants.MEETING_ID).getAsString(); - String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); - - JsonArray history = (JsonArray) payload.get(Constants.CHAT_HISTORY); - - Util util = new Util(); - - ArrayList> chatHistory = util.extractChatHistory(history); - - return new GetChatHistoryReplyMessage(meetingId, requesterId, chatHistory); - } - } - } - } - return null; - } -} 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 deleted file mode 100755 index 8294876ad2..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/GetChatHistoryRequestMessage.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.bigbluebutton.common.messages; - -import java.util.HashMap; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -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"; - - public final String meetingId; - public final String replyTo; - public final String requesterId; - - - public GetChatHistoryRequestMessage(String meetingId, String requesterId, String replyTo) { - this.meetingId = meetingId; - this.replyTo = replyTo; - this.requesterId = requesterId; - } - - public String toJson() { - HashMap payload = new HashMap(); - payload.put(Constants.MEETING_ID, meetingId); - payload.put(Constants.REPLY_TO, replyTo); - payload.put(Constants.REQUESTER_ID, requesterId); - - java.util.HashMap header = MessageBuilder.buildHeader(GET_CHAT_HISTORY_REQUEST, VERSION, null); - return MessageBuilder.buildJson(header, payload); - } - - public static GetChatHistoryRequestMessage fromJson(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"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (GET_CHAT_HISTORY_REQUEST.equals(messageName)) { - - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.REPLY_TO) - && payload.has(Constants.REQUESTER_ID)) { - String meetingId = payload.get(Constants.MEETING_ID).getAsString(); - String replyTo = payload.get(Constants.REPLY_TO).getAsString(); - String requesterId = payload.get(Constants.REQUESTER_ID).getAsString(); - - return new GetChatHistoryRequestMessage(meetingId, requesterId, replyTo); - } - } - } - } - return null; - } -} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java index f8213db22b..16b6be4a25 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/MessagingConstants.java @@ -27,7 +27,6 @@ public class MessagingConstants { public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation"; public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling"; public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users"; - public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat"; public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard"; public static final String FROM_DESK_SHARE_CHANNEL = FROM_BBB_APPS_CHANNEL + ":deskshare"; @@ -38,7 +37,6 @@ public class MessagingConstants { public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation"; public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling"; public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users"; - public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat"; public static final String TO_VOICE_CHANNEL = TO_BBB_APPS_CHANNEL + ":voice"; public static final String TO_WHITEBOARD_CHANNEL = TO_BBB_APPS_CHANNEL + ":whiteboard"; 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 deleted file mode 100755 index 60262dd097..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPrivateChatMessage.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.bigbluebutton.common.messages; - -import java.util.HashMap; -import java.util.Map; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -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"; - - public final String meetingId; - public final String requesterId; - public final Map messageInfo; - - public SendPrivateChatMessage(String meetingId, String requesterId, - Map message) { - this.meetingId = meetingId; - this.requesterId = requesterId; - this.messageInfo = message; - } - - public String toJson() { - HashMap payload = new HashMap(); - - Map message = new HashMap(); - - message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE)); - message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE)); - message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME)); - message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET)); - message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR)); - message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID)); - message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID)); - message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME)); - message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME)); - - payload.put(Constants.MESSAGE, message); - payload.put(Constants.MEETING_ID, meetingId); - - java.util.HashMap header = MessageBuilder.buildHeader(SEND_PRIVATE_CHAT_MESSAGE, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - - public static SendPrivateChatMessage fromJson(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"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (SEND_PRIVATE_CHAT_MESSAGE.equals(messageName)) { - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.MESSAGE)) { - String meetingId = payload.get(Constants.MEETING_ID).getAsString(); - - JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject(); - Map messageInfo = new HashMap(); - - if (msgObj.has(ChatKeyUtil.CHAT_TYPE) - && msgObj.has(ChatKeyUtil.MESSAGE) - && msgObj.has(ChatKeyUtil.TO_USERNAME) - && msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET) - && msgObj.has(ChatKeyUtil.FROM_COLOR) - && msgObj.has(ChatKeyUtil.TO_USERID) - && msgObj.has(ChatKeyUtil.FROM_USERID) - && msgObj.has(ChatKeyUtil.FROM_TIME) - && msgObj.has(ChatKeyUtil.FROM_USERNAME)){ - messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString()); - messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString()); - - String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); - - return new SendPrivateChatMessage(meetingId, requesterId, messageInfo); - } else if (msgObj.has(Constants.CHAT_TYPE) - && msgObj.has(Constants.MESSAGE) - && msgObj.has(Constants.TO_USERNAME) - && msgObj.has(Constants.FROM_TZ_OFFSET) - && msgObj.has(Constants.FROM_COLOR) - && msgObj.has(Constants.TO_USERID) - && msgObj.has(Constants.FROM_USERID) - && msgObj.has(Constants.FROM_TIME) - && msgObj.has(Constants.FROM_USERNAME)){ - messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString()); - messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString()); - - String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); - - return new SendPrivateChatMessage(meetingId, requesterId, messageInfo); - } - } - } - } - } - return null; - } -} 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 deleted file mode 100755 index ec9f1c30eb..0000000000 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/SendPublicChatMessage.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.bigbluebutton.common.messages; - -import java.util.HashMap; -import java.util.Map; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -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"; - - public final String meetingId; - public final String requesterId; - public final Map messageInfo; - - public SendPublicChatMessage(String meetingId, String requesterId, - Map message) { - this.meetingId = meetingId; - this.requesterId = requesterId; - this.messageInfo = message; - } - - public String toJson() { - HashMap payload = new HashMap(); - - Map message = new HashMap(); - - message.put(ChatKeyUtil.CHAT_TYPE, messageInfo.get(ChatKeyUtil.CHAT_TYPE)); - message.put(ChatKeyUtil.MESSAGE, messageInfo.get(ChatKeyUtil.MESSAGE)); - message.put(ChatKeyUtil.TO_USERNAME, messageInfo.get(ChatKeyUtil.TO_USERNAME)); - message.put(ChatKeyUtil.FROM_TZ_OFFSET, messageInfo.get(ChatKeyUtil.FROM_TZ_OFFSET)); - message.put(ChatKeyUtil.FROM_COLOR, messageInfo.get(ChatKeyUtil.FROM_COLOR)); - message.put(ChatKeyUtil.TO_USERID, messageInfo.get(ChatKeyUtil.TO_USERID)); - message.put(ChatKeyUtil.FROM_USERID, messageInfo.get(ChatKeyUtil.FROM_USERID)); - message.put(ChatKeyUtil.FROM_TIME, messageInfo.get(ChatKeyUtil.FROM_TIME)); - message.put(ChatKeyUtil.FROM_USERNAME, messageInfo.get(ChatKeyUtil.FROM_USERNAME)); - - payload.put(Constants.MESSAGE, message); - payload.put(Constants.MEETING_ID, meetingId); - - java.util.HashMap header = MessageBuilder.buildHeader(SEND_PUBLIC_CHAT_MESSAGE, VERSION, null); - - return MessageBuilder.buildJson(header, payload); - } - - public static SendPublicChatMessage fromJson(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"); - JsonObject payload = (JsonObject) obj.get("payload"); - - if (header.has("name")) { - String messageName = header.get("name").getAsString(); - if (SEND_PUBLIC_CHAT_MESSAGE.equals(messageName)) { - if (payload.has(Constants.MEETING_ID) - && payload.has(Constants.MESSAGE)) { - String meetingId = payload.get(Constants.MEETING_ID).getAsString(); - - JsonObject msgObj = (JsonObject) payload.get(Constants.MESSAGE).getAsJsonObject(); - Map messageInfo = new HashMap(); - - if (msgObj.has(ChatKeyUtil.CHAT_TYPE) - && msgObj.has(ChatKeyUtil.MESSAGE) - && msgObj.has(ChatKeyUtil.TO_USERNAME) - && msgObj.has(ChatKeyUtil.FROM_TZ_OFFSET) - && msgObj.has(ChatKeyUtil.FROM_COLOR) - && msgObj.has(ChatKeyUtil.TO_USERID) - && msgObj.has(ChatKeyUtil.FROM_USERID) - && msgObj.has(ChatKeyUtil.FROM_TIME) - && msgObj.has(ChatKeyUtil.FROM_USERNAME)){ - messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(ChatKeyUtil.CHAT_TYPE).getAsString()); - messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(ChatKeyUtil.MESSAGE).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(ChatKeyUtil.TO_USERNAME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(ChatKeyUtil.FROM_TZ_OFFSET).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(ChatKeyUtil.FROM_COLOR).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(ChatKeyUtil.TO_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(ChatKeyUtil.FROM_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(ChatKeyUtil.FROM_TIME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(ChatKeyUtil.FROM_USERNAME).getAsString()); - - String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); - - return new SendPublicChatMessage(meetingId, requesterId, messageInfo); - } else if (msgObj.has(Constants.CHAT_TYPE) - && msgObj.has(Constants.MESSAGE) - && msgObj.has(Constants.TO_USERNAME) - && msgObj.has(Constants.FROM_TZ_OFFSET) - && msgObj.has(Constants.FROM_COLOR) - && msgObj.has(Constants.TO_USERID) - && msgObj.has(Constants.FROM_USERID) - && msgObj.has(Constants.FROM_TIME) - && msgObj.has(Constants.FROM_USERNAME)){ - messageInfo.put(ChatKeyUtil.CHAT_TYPE, msgObj.get(Constants.CHAT_TYPE).getAsString()); - messageInfo.put(ChatKeyUtil.MESSAGE, msgObj.get(Constants.MESSAGE).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERNAME, msgObj.get(Constants.TO_USERNAME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TZ_OFFSET, msgObj.get(Constants.FROM_TZ_OFFSET).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_COLOR, msgObj.get(Constants.FROM_COLOR).getAsString()); - messageInfo.put(ChatKeyUtil.TO_USERID, msgObj.get(Constants.TO_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERID, msgObj.get(Constants.FROM_USERID).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_TIME, msgObj.get(Constants.FROM_TIME).getAsString()); - messageInfo.put(ChatKeyUtil.FROM_USERNAME, msgObj.get(Constants.FROM_USERNAME).getAsString()); - - String requesterId = messageInfo.get(ChatKeyUtil.FROM_USERID); - - return new SendPublicChatMessage(meetingId, requesterId, messageInfo); - } - } - } - } - } - return null; - } -} diff --git a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/Util.java b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/Util.java index f8cfafd1d0..975c36f5fd 100755 --- a/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/Util.java +++ b/bbb-common-message/src/main/java/org/bigbluebutton/common/messages/Util.java @@ -170,48 +170,6 @@ public class Util { return null; } - public ArrayList> extractChatHistory(JsonArray history) { - ArrayList> collection = new ArrayList>(); - Iterator historyIter = history.iterator(); - while (historyIter.hasNext()){ - JsonElement chat = historyIter.next(); - Map chatMap = extractChat((JsonObject)chat); - if (chatMap != null) { - collection.add(chatMap); - } - } - return collection; - } - - private Map extractChat(JsonObject chat) { - - if (chat.has(Constants.FROM_COLOR) - && chat.has(Constants.MESSAGE) - && chat.has(Constants.TO_USERNAME) - && chat.has(Constants.FROM_TZ_OFFSET) - && chat.has(Constants.FROM_COLOR) - && chat.has(Constants.TO_USERID) - && chat.has(Constants.FROM_USERID) - && chat.has(Constants.FROM_TIME) - && chat.has(Constants.FROM_USERNAME)){ - - Map chatMap = new HashMap(); - - chatMap.put(ChatKeyUtil.CHAT_TYPE, chat.get(Constants.CHAT_TYPE).getAsString()); - chatMap.put(ChatKeyUtil.MESSAGE, chat.get(Constants.MESSAGE).getAsString()); - chatMap.put(ChatKeyUtil.TO_USERNAME, chat.get(Constants.TO_USERNAME).getAsString()); - chatMap.put(ChatKeyUtil.FROM_TZ_OFFSET, chat.get(Constants.FROM_TZ_OFFSET).getAsString()); - chatMap.put(ChatKeyUtil.FROM_COLOR, chat.get(Constants.FROM_COLOR).getAsString()); - chatMap.put(ChatKeyUtil.TO_USERID, chat.get(Constants.TO_USERID).getAsString()); - chatMap.put(ChatKeyUtil.FROM_USERID, chat.get(Constants.FROM_USERID).getAsString()); - chatMap.put(ChatKeyUtil.FROM_TIME, chat.get(Constants.FROM_TIME).getAsString()); - chatMap.put(ChatKeyUtil.FROM_USERNAME, chat.get(Constants.FROM_USERNAME).getAsString()); - - return chatMap; - } - return null; - } - public ArrayList> extractUsers(JsonArray users) { ArrayList> collection = new ArrayList>(); 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 a8aba4f11b..f99b49b956 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 @@ -233,26 +233,6 @@ public class MessagePublisher { sender.send(MessagingConstants.TO_USERS_CHANNEL, msg.toJson()); } - public void getChatHistory(String meetingID, String requesterID, String replyTo) { - GetChatHistoryRequestMessage msg = new GetChatHistoryRequestMessage(meetingID, requesterID, replyTo); - sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson()); - } - - public void clearPublicChatMessages(String meetingID, String requesterID) { - ClearPublicChatHistoryRequestMessage msg = new ClearPublicChatHistoryRequestMessage(meetingID, requesterID); - sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson()); - } - - public void sendPublicMessage(String meetingID, String requesterID, Map message) { - SendPublicChatMessage msg = new SendPublicChatMessage(meetingID, requesterID, message); - sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson()); - } - - public void sendPrivateMessage(String meetingID, String requesterID, Map message) { - SendPrivateChatMessage msg = new SendPrivateChatMessage(meetingID, requesterID, message); - sender.send(MessagingConstants.TO_CHAT_CHANNEL, msg.toJson()); - } - public void requestDeskShareInfo(String meetingID, String requesterID, String replyTo) { DeskShareGetInfoRequestMessage msg = new DeskShareGetInfoRequestMessage(meetingID, requesterID, replyTo); sender.send(MessagingConstants.FROM_VOICE_CONF_SYSTEM_CHAN, msg.toJson()); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/RedisPubSubMessageHandler.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/RedisPubSubMessageHandler.java index bf3c10fcb0..6f1ecc9fea 100755 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/RedisPubSubMessageHandler.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/pubsub/redis/RedisPubSubMessageHandler.java @@ -5,7 +5,6 @@ import org.bigbluebutton.red5.client.MeetingClientMessageSender; import org.bigbluebutton.red5.client.PollingClientMessageSender; import org.bigbluebutton.red5.client.PresentationClientMessageSender; import org.bigbluebutton.red5.client.UserClientMessageSender; -import org.bigbluebutton.red5.client.ChatClientMessageSender; import org.bigbluebutton.red5.client.WhiteboardClientMessageSender; import org.bigbluebutton.red5.client.DeskShareMessageSender; import org.bigbluebutton.red5.client.messaging.IConnectionInvokerService; @@ -17,7 +16,6 @@ public class RedisPubSubMessageHandler implements MessageHandler { private IConnectionInvokerService service; private UserClientMessageSender userMessageSender; private MeetingClientMessageSender meetingMessageSender; - private ChatClientMessageSender chatMessageSender; private PresentationClientMessageSender presentationMessageSender; private WhiteboardClientMessageSender whiteboardMessageSender; private DeskShareMessageSender deskShareMessageSender; @@ -28,7 +26,6 @@ public class RedisPubSubMessageHandler implements MessageHandler { this.service = s; userMessageSender = new UserClientMessageSender(service); meetingMessageSender = new MeetingClientMessageSender(service); - chatMessageSender = new ChatClientMessageSender(service); presentationMessageSender = new PresentationClientMessageSender(service); whiteboardMessageSender = new WhiteboardClientMessageSender(service); deskShareMessageSender = new DeskShareMessageSender(service); @@ -42,9 +39,7 @@ public class RedisPubSubMessageHandler implements MessageHandler { @Override public void handleMessage(String pattern, String channel, String message) { // System.out.println("in red5 getting message: " + channel + " " + message); - if (channel.equalsIgnoreCase(MessagingConstants.FROM_CHAT_CHANNEL)) { - chatMessageSender.handleChatMessage(message); - } else if (channel.equalsIgnoreCase(MessagingConstants.FROM_PRESENTATION_CHANNEL)) { + if (channel.equalsIgnoreCase(MessagingConstants.FROM_PRESENTATION_CHANNEL)) { presentationMessageSender.handlePresentationMessage(message); } else if (channel.equalsIgnoreCase(MessagingConstants.FROM_MEETING_CHANNEL)) { meetingMessageSender.handleMeetingMessage(message); diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatKeyUtil.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatKeyUtil.java deleted file mode 100755 index f8124cb30d..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatKeyUtil.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.bigbluebutton.red5.service; - -public class ChatKeyUtil { - public static final String CHAT_TYPE = "chatType"; - public static final String FROM_USERID = "fromUserID"; - public static final String FROM_USERNAME = "fromUsername"; - public static final String FROM_COLOR = "fromColor"; - public static final String FROM_TIME = "fromTime"; - public static final String FROM_TZ_OFFSET = "fromTimezoneOffset"; - public static final String TO_USERID = "toUserID"; - public static final String TO_USERNAME = "toUsername"; - public static final String MESSAGE = "message"; -} diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java deleted file mode 100755 index 1abd101cbd..0000000000 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/red5/service/ChatService.java +++ /dev/null @@ -1,132 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2012 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 3.0 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.red5.service; - -import java.util.HashMap; -import java.util.Map; -import java.util.Date; - -import org.bigbluebutton.red5.BigBlueButtonSession; -import org.bigbluebutton.red5.Constants; -import org.bigbluebutton.red5.pubsub.MessagePublisher; -import org.red5.server.api.Red5; - -public class ChatService { - - private MessagePublisher red5BBBInGw; - private int maxMessageLength; - - public void sendPublicChatHistory() { - String meetingID = Red5.getConnectionLocal().getScope().getName(); - String requesterID = getBbbSession().getInternalUserID(); - // Just hardcode as we don't really need it for flash client. (ralam may 7, 2014) - String replyTo = meetingID + "/" + requesterID; - - red5BBBInGw.getChatHistory(meetingID, requesterID, replyTo); - } - - public void clearPublicChatMessages() { - String meetingID = Red5.getConnectionLocal().getScope().getName(); - String requesterID = getBbbSession().getInternalUserID(); - - red5BBBInGw.clearPublicChatMessages(meetingID, requesterID); - } - - private BigBlueButtonSession getBbbSession() { - return (BigBlueButtonSession) Red5.getConnectionLocal().getAttribute(Constants.SESSION); - } - - public void sendPublicMessage(Map msg) { - - String chatType = msg.get(ChatKeyUtil.CHAT_TYPE).toString(); - String fromUserID = msg.get(ChatKeyUtil.FROM_USERID).toString(); - String fromUsername = msg.get(ChatKeyUtil.FROM_USERNAME ).toString(); - String fromColor = msg.get(ChatKeyUtil.FROM_COLOR).toString(); - String fromTime = Long.toString(new Date().getTime()); - String fromTimezoneOffset = msg.get(ChatKeyUtil.FROM_TZ_OFFSET).toString(); - String toUserID = msg.get(ChatKeyUtil.TO_USERID).toString(); - String toUsername = msg.get(ChatKeyUtil.TO_USERNAME).toString(); - String chatText = msg.get(ChatKeyUtil.MESSAGE).toString(); - - Map message = new HashMap(); - message.put(ChatKeyUtil.CHAT_TYPE, chatType); - message.put(ChatKeyUtil.FROM_USERID, fromUserID); - message.put(ChatKeyUtil.FROM_USERNAME, fromUsername); - message.put(ChatKeyUtil.FROM_COLOR, fromColor); - message.put(ChatKeyUtil.FROM_TIME, fromTime); - message.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset); - message.put(ChatKeyUtil.TO_USERID, toUserID); - message.put(ChatKeyUtil.TO_USERNAME, toUsername); - message.put(ChatKeyUtil.MESSAGE, chatText); - - String meetingID = Red5.getConnectionLocal().getScope().getName(); - String requesterID = getBbbSession().getInternalUserID(); - - // The message is being ignored in the red5 application to avoid copying it to any another application which that may cause a memory issue - if (chatText.length() <= maxMessageLength) { - red5BBBInGw.sendPublicMessage(meetingID, requesterID, message); - } - else { - // log.warn("sendPublicMessage maximum allowed message length exceeded (length: [" + chatText.length() + "], message: [" + chatText + "])"); - } - } - - public void setRed5Publisher(MessagePublisher inGW) { - red5BBBInGw = inGW; - } - - public void setMaxMessageLength(int maxLength) { - maxMessageLength = maxLength; -} - - - public void sendPrivateMessage(Map msg){ - String chatType = msg.get(ChatKeyUtil.CHAT_TYPE).toString(); - String fromUserID = msg.get(ChatKeyUtil.FROM_USERID).toString(); - String fromUsername = msg.get(ChatKeyUtil.FROM_USERNAME ).toString(); - String fromColor = msg.get(ChatKeyUtil.FROM_COLOR).toString(); - String fromTime = Long.toString(new Date().getTime()); - String fromTimezoneOffset = msg.get(ChatKeyUtil.FROM_TZ_OFFSET).toString(); - String toUserID = msg.get(ChatKeyUtil.TO_USERID).toString(); - String toUsername = msg.get(ChatKeyUtil.TO_USERNAME).toString(); - String chatText = msg.get(ChatKeyUtil.MESSAGE).toString(); - - Map message = new HashMap(); - message.put(ChatKeyUtil.CHAT_TYPE, chatType); - message.put(ChatKeyUtil.FROM_USERID, fromUserID); - message.put(ChatKeyUtil.FROM_USERNAME, fromUsername); - message.put(ChatKeyUtil.FROM_COLOR, fromColor); - message.put(ChatKeyUtil.FROM_TIME, fromTime); - message.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset); - message.put(ChatKeyUtil.TO_USERID, toUserID); - message.put(ChatKeyUtil.TO_USERNAME, toUsername); - message.put(ChatKeyUtil.MESSAGE, chatText); - - String meetingID = Red5.getConnectionLocal().getScope().getName(); - String requesterID = getBbbSession().getInternalUserID(); - - // The message is being ignored in the red5 application to avoid copying it to any another application which that may cause a memory issue - if (chatText.length() <= maxMessageLength) { - red5BBBInGw.sendPrivateMessage(meetingID, requesterID, message); - } - else { - // log.warn("sendPrivateMessage maximum allowed message length exceeded (length: [" + chatText.length() + "], message: [" + chatText + "])"); - } - } -} diff --git a/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml b/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml index b33f9c4ccc..dedc6e45a0 100755 --- a/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml +++ b/bigbluebutton-apps/src/main/webapp/WEB-INF/red5-web.xml @@ -86,11 +86,6 @@ with BigBlueButton; if not, see . - - - - - From e30ba203234d7ee881eb94d607dfbc4382299a15 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Fri, 7 Jul 2017 20:16:43 -0400 Subject: [PATCH 26/28] avoid exception when cursor user isn't found --- .../modules/whiteboard/WhiteboardCanvasDisplayModel.as | 1 + 1 file changed, 1 insertion(+) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as index 0dc74885c1..d4240e2829 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as @@ -200,6 +200,7 @@ package org.bigbluebutton.modules.whiteboard public function drawCursor(userId:String, xPercent:Number, yPercent:Number):void { if (!_cursors.hasOwnProperty(userId)) { var userName:String = UsersUtil.getUserName(userId); + if (userName == null) userName = "Unknown"; var newCursor:WhiteboardCursor = new WhiteboardCursor(userId, userName, xPercent, yPercent, shapeFactory.parentWidth, shapeFactory.parentHeight, presenterId == userId); wbCanvas.addCursor(newCursor); From 1320988a95c380caaa84f24269cc15bd7bf00383 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Sat, 8 Jul 2017 07:22:45 -0700 Subject: [PATCH 27/28] - handle register user properly --- .../org/bigbluebutton/core/BigBlueButtonActor.scala | 1 + .../pubsub/senders/ReceivedJsonMsgHandlerActor.scala | 7 +++---- .../org/bigbluebutton/core/running/MeetingActor.scala | 6 ++++-- .../endpoint/redis/AppsRedisSubscriberActor.scala | 2 +- .../java/org/bigbluebutton/api/MeetingService.java | 11 +---------- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala index edb304ab14..f489b638fb 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonActor.scala @@ -85,6 +85,7 @@ class BigBlueButtonActor(val system: ActorSystem, for { m <- RunningMeetings.findWithId(meetings, msg.header.meetingId) } yield { + log.debug("FORWARDING Registere user message") m.actorRef forward (msg) } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index 17a8778deb..039fdfc025 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -6,7 +6,6 @@ import com.fasterxml.jackson.databind.JsonNode import org.bigbluebutton.common2.msgs._ import org.bigbluebutton.core.bus._ import org.bigbluebutton.core2.ReceivedMessageRouter - import scala.reflect.runtime.universe._ object ReceivedJsonMsgHandlerActor { @@ -24,7 +23,7 @@ class ReceivedJsonMsgHandlerActor( def receive = { case msg: ReceivedJsonMessage => - log.debug("handling {} - {}", msg.channel, msg.data) + //log.debug("handling {} - {}", msg.channel, msg.data) handleReceivedJsonMessage(msg) case _ => // do nothing } @@ -44,8 +43,8 @@ class ReceivedJsonMsgHandlerActor( } def handle(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = { - if (SendCursorPositionPubMsg.NAME != envelope.name) - log.debug("Route envelope name " + envelope.name) + // if (SendCursorPositionPubMsg.NAME != envelope.name) + // log.debug("Route envelope name " + envelope.name) envelope.name match { case CreateMeetingReqMsg.NAME => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index 4379f4b8b7..eeac5ed111 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -103,6 +103,9 @@ class MeetingActor(val props: DefaultProps, // 2x messages case msg: BbbCommonEnvCoreMsg => handleBbbCommonEnvCoreMsg(msg) + // Handling RegisterUserReqMsg as it is forwarded from BBBActor and + // its type is not BbbCommonEnvCoreMsg + case m: RegisterUserReqMsg => handleRegisterUserReqMsg(m) case m: GetAllMeetingsReqMsg => handleGetAllMeetingsReqMsg(m) //====================================== @@ -139,11 +142,10 @@ class MeetingActor(val props: DefaultProps, } private def handleBbbCommonEnvCoreMsg(msg: BbbCommonEnvCoreMsg): Unit = { - msg.core match { + msg.core match { // Users case m: ValidateAuthTokenReqMsg => handleValidateAuthTokenReqMsg(m) - case m: RegisterUserReqMsg => handleRegisterUserReqMsg(m) case m: UserJoinMeetingReqMsg => handleUserJoinMeetingReqMsg(m) case m: UserLeaveReqMsg => handleUserLeaveReqMsg(m) case m: UserBroadcastCamStartMsg => handleUserBroadcastCamStartMsg(m) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala index a161cad121..e60c9649fa 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/AppsRedisSubscriberActor.scala @@ -51,7 +51,7 @@ class AppsRedisSubscriberActor(msgReceiver: RedisMessageReceiver, jsonMsgBus: In //log.error(s"SHOULD NOT BE RECEIVING: $message") if (message.channel == toAkkaAppsRedisChannel || message.channel == fromVoiceConfRedisChannel) { val receivedJsonMessage = new ReceivedJsonMessage(message.channel, message.data.utf8String) - log.debug(s"RECEIVED:\n [${receivedJsonMessage.channel}] \n ${receivedJsonMessage.data} \n") + // log.debug(s"RECEIVED:\n [${receivedJsonMessage.channel}] \n ${receivedJsonMessage.data} \n") jsonMsgBus.publish(IncomingJsonMessage(toAkkaAppsJsonChannel, receivedJsonMessage)) } } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java index 766f906fe3..8dbf8c5215 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java @@ -30,12 +30,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.Set; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; -import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.*; import org.bigbluebutton.api.domain.*; import org.bigbluebutton.api.messaging.MessageListener; @@ -285,10 +280,6 @@ public class MeetingService implements MessageListener { gw.registerUser(message.meetingID, message.internalUserId, message.fullname, message.role, message.externUserID, message.authToken, message.avatarURL, message.guest, message.authed); - - gw.registerUser(message.meetingID, - message.internalUserId, message.fullname, message.role, - message.externUserID, message.authToken, message.avatarURL, message.guest, message.authed); } public Meeting getMeeting(String meetingId) { From f77b29bad398047c83bd38781f1e4ec28501cbbc Mon Sep 17 00:00:00 2001 From: perroned Date: Sat, 8 Jul 2017 11:29:13 -0400 Subject: [PATCH 28/28] Restores 1.1 ss --- .../modules/screenshare/events/ShareEvent.as | 16 - .../managers/PublishWindowManager.as | 32 +- .../managers/ScreenshareManager.as | 99 ++--- .../managers/SmartWindowResizer.as | 76 ---- .../managers/ViewerWindowManager.as | 25 +- .../managers/WebRTCDeskshareManager.as | 13 +- .../screenshare/maps/ScreenshareEventMap.mxml | 329 ++++++++------- .../maps/WebRTCDeskshareEventMap.mxml | 282 ++++++------- .../screenshare/model/ScreenshareOptions.as | 92 ++--- .../components/ScreensharePublishWindow.mxml | 355 ++++++++-------- .../components/ScreenshareViewWindow.mxml | 385 ++++++++++-------- .../view/components/ToolbarButton.mxml | 48 +-- .../view/components/VideoWithWarnings.as | 46 --- .../WebRTCDesktopPublishWindow.mxml | 111 +++-- .../components/WebRTCDesktopViewWindow.mxml | 46 +-- 15 files changed, 911 insertions(+), 1044 deletions(-) delete mode 100644 bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/SmartWindowResizer.as delete mode 100755 bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/VideoWithWarnings.as diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/events/ShareEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/events/ShareEvent.as index 9fada0b15b..4f07471be3 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/events/ShareEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/events/ShareEvent.as @@ -19,28 +19,12 @@ package org.bigbluebutton.modules.screenshare.events { import flash.events.Event; - import org.bigbluebutton.modules.screenshare.view.components.ScreensharePublishWindow; - import org.bigbluebutton.modules.screenshare.view.components.ScreenshareViewWindow; public class ShareEvent extends Event { public static const START_SHARING:String = "SCREENSHARE START SHARING"; public static const STOP_SHARING:String = "SCREENSHARE STOP SHARING"; - - public static const CREATE_SCREENSHARE_PUBLISH_TAB:String = "CREATE SCREENSHARE PUBLISH TAB"; - public static const REFRESH_SCREENSHARE_PUBLISH_TAB:String = "REFRESH SCREENSHARE PUBLISH TAB"; - public static const CLEAN_SCREENSHARE_PUBLISH_TAB:String = "CLEAN SCREENSHARE PUBLISH TAB"; - - public static const OPEN_SCREENSHARE_VIEW_TAB:String = "OPEN SCREENSHARE VIEW TAB"; - public static const CLOSE_SCREENSHARE_VIEW_TAB:String = "CLOSE SCREENSHARE VIEW TAB"; - - public static const SHARE_SCREEN:String = "SHARE SCREEN"; - public static const CHANGE_VIDEO_DISPLAY_MODE:String = "CHANGE VIDEO DISPLAY MODE"; - public var publishTabContent:ScreensharePublishWindow; - public var viewTabContent:ScreenshareViewWindow; - public var fullScreen:Boolean; - public function ShareEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) { super(type, bubbles, cancelable); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/PublishWindowManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/PublishWindowManager.as index e839587a4b..97f5424eb8 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/PublishWindowManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/PublishWindowManager.as @@ -31,7 +31,6 @@ package org.bigbluebutton.modules.screenshare.managers { import org.bigbluebutton.common.events.OpenWindowEvent; import org.bigbluebutton.modules.screenshare.services.ScreenshareService; import org.bigbluebutton.modules.screenshare.view.components.ScreensharePublishWindow; - import org.bigbluebutton.modules.screenshare.events.ShareEvent; public class PublishWindowManager { private static const LOGGER:ILogger = getClassLogger(PublishWindowManager); @@ -48,10 +47,7 @@ package org.bigbluebutton.modules.screenshare.managers { } public function stopSharing():void { - if (shareWindow != null) { - shareWindow.stopSharing(); - shareWindow = null; - } + if (shareWindow != null) shareWindow.stopSharing(); } public function startSharing(uri:String, room:String, tunnel:Boolean):void { @@ -63,27 +59,23 @@ package org.bigbluebutton.modules.screenshare.managers { openWindow(shareWindow); } } - - public function handleShareScreenEvent(fullScreen:Boolean):void { - if (shareWindow != null) { - LOGGER.debug("Starting deskshare publishing. fullScreen = " + fullScreen); - shareWindow.shareScreen(fullScreen); - } - } public function handleShareWindowCloseEvent():void { - closeWindow(); + closeWindow(shareWindow); } - private function openWindow(window:ScreensharePublishWindow):void { - var e:ShareEvent = new ShareEvent(ShareEvent.CREATE_SCREENSHARE_PUBLISH_TAB); - e.publishTabContent = window; - globalDispatcher.dispatchEvent(e); + private function openWindow(window:IBbbModuleWindow):void { + var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT); + event.window = window; + globalDispatcher.dispatchEvent(event); } - private function closeWindow():void { - var e:ShareEvent = new ShareEvent(ShareEvent.CLEAN_SCREENSHARE_PUBLISH_TAB); - globalDispatcher.dispatchEvent(e); + private function closeWindow(window:IBbbModuleWindow):void { + var event:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT); + event.window = window; + globalDispatcher.dispatchEvent(event); + + shareWindow = null; } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ScreenshareManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ScreenshareManager.as index 842c6f9f20..ba5418c8c0 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ScreenshareManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ScreenshareManager.as @@ -19,7 +19,6 @@ package org.bigbluebutton.modules.screenshare.managers { import com.asfusion.mate.events.Dispatcher; - import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; import org.bigbluebutton.core.Options; @@ -36,10 +35,10 @@ package org.bigbluebutton.modules.screenshare.managers { import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions; import org.bigbluebutton.modules.screenshare.services.ScreenshareService; import org.bigbluebutton.modules.screenshare.utils.BrowserCheck; - + public class ScreenshareManager { private static const LOGGER:ILogger = getClassLogger(ScreenshareManager); - + private var publishWindowManager:PublishWindowManager; private var viewWindowManager:ViewerWindowManager; private var toolbarButtonManager:ToolbarButtonManager; @@ -51,68 +50,72 @@ package org.bigbluebutton.modules.screenshare.managers { private var options:ScreenshareOptions; public function ScreenshareManager() { - options = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; - - service = new ScreenshareService(); + options = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; + service = new ScreenshareService(); globalDispatcher = new Dispatcher(); publishWindowManager = new PublishWindowManager(service); viewWindowManager = new ViewerWindowManager(service); toolbarButtonManager = new ToolbarButtonManager(); } - + public function handleStartModuleEvent(module:ScreenshareModule):void { LOGGER.debug("Screenshare Module starting"); this.module = module; service.handleStartModuleEvent(module); - + if (UsersUtil.amIPresenter()) { initDeskshare(); } } - + public function handleStopModuleEvent():void { LOGGER.debug("Screenshare Module stopping"); publishWindowManager.stopSharing(); viewWindowManager.stopViewing(); service.disconnect(); } - + public function handleConnectionSuccessEvent():void { LOGGER.debug("handle Connection Success Event"); service.checkIfPresenterIsSharingScreen(); } - + public function handleScreenShareStartedEvent(event:ShareStartedEvent):void { ScreenshareModel.getInstance().streamId = event.streamId; ScreenshareModel.getInstance().width = event.width; ScreenshareModel.getInstance().height = event.height; ScreenshareModel.getInstance().url = event.url; - - handleStreamStartEvent(ScreenshareModel.getInstance().streamId, event.width, event.height); - + + if (UsersUtil.amIPresenter()) { + // var dispatcher:Dispatcher = new Dispatcher(); + // dispatcher.dispatchEvent(new ViewStreamEvent(ViewStreamEvent.START)); + } else { + handleStreamStartEvent(ScreenshareModel.getInstance().streamId, event.width, event.height); + } + var dispatcher:Dispatcher = new Dispatcher(); dispatcher.dispatchEvent(new ViewStreamEvent(ViewStreamEvent.START)); } - + public function handleIsSharingScreenEvent(event:IsSharingScreenEvent):void { ScreenshareModel.getInstance().streamId = event.streamId; ScreenshareModel.getInstance().width = event.width; ScreenshareModel.getInstance().height = event.height; ScreenshareModel.getInstance().url = event.url; ScreenshareModel.getInstance().session = event.session - + if (UsersUtil.amIPresenter()) { // var dispatcher:Dispatcher = new Dispatcher(); - // dispatcher.dispatchEvent(new ViewStreamEvent(ViewStreamEvent.START)); + // dispatcher.dispatchEvent(new ViewStreamEvent(ViewStreamEvent.START)); } else { handleStreamStartEvent(ScreenshareModel.getInstance().streamId, event.width, event.height); - + } - + var dispatcher:Dispatcher = new Dispatcher(); dispatcher.dispatchEvent(new ViewStreamEvent(ViewStreamEvent.START)); } - + private function handleStreamStartEvent(streamId:String, videoWidth:Number, videoHeight:Number):void { LOGGER.debug("Received start vieweing command"); //if (!usingJava) { return; } @@ -121,16 +124,17 @@ package org.bigbluebutton.modules.screenshare.managers { private function initDeskshare():void { sharing = false; + if (options.showButton) { toolbarButtonManager.addToolbarButton(); } } - + public function handleMadePresenterEvent(e:MadePresenterEvent):void { LOGGER.debug("Got MadePresenterEvent "); initDeskshare(); } - + public function handleMadeViewerEvent(e:MadePresenterEvent):void { LOGGER.debug("Got MadeViewerEvent "); toolbarButtonManager.removeToolbarButton(); @@ -140,9 +144,10 @@ package org.bigbluebutton.modules.screenshare.managers { } sharing = false; } - + public function handleRequestStartSharingEvent(force:Boolean = false):void { toolbarButtonManager.startedSharing(); + if (force || (options.tryWebRTCFirst && !BrowserCheck.isWebRTCSupported()) || !options.tryWebRTCFirst) { usingJava = true; publishWindowManager.startSharing(module.getCaptureServerUri(), module.getRoom(), module.tunnel()); @@ -153,29 +158,29 @@ package org.bigbluebutton.modules.screenshare.managers { usingJava = false; } } - + public function handleShareStartEvent():void { - service.sharingStartMessage(ScreenshareModel.getInstance().session); + service.sharingStartMessage(ScreenshareModel.getInstance().session); } - + public function handleScreenShareClientPingMessage(event: ScreenShareClientPingMessage):void { service.sendClientPongMessage(event.session, event.timestamp); } - + public function handleRequestPauseSharingEvent():void { service.requestPauseSharing(ScreenshareModel.getInstance().streamId); } - + public function handleRequestRestartSharingEvent():void { service.requestRestartSharing(); } - + public function handleRequestStopSharingEvent():void { service.requestStopSharing(ScreenshareModel.getInstance().streamId); publishWindowManager.handleShareWindowCloseEvent(); - toolbarButtonManager.stoppedSharing(); + toolbarButtonManager.stoppedSharing(); } - + public function handleShareStartRequestResponseEvent(event:ShareStartRequestResponseEvent):void { var dispatcher:Dispatcher = new Dispatcher(); if (event.success) { @@ -183,32 +188,19 @@ package org.bigbluebutton.modules.screenshare.managers { ScreenshareModel.getInstance().jnlp = event.jnlp; ScreenshareModel.getInstance().streamId = event.streamId; ScreenshareModel.getInstance().session = event.session; - + dispatcher.dispatchEvent(new StartShareRequestSuccessEvent(ScreenshareModel.getInstance().authToken)); } else { dispatcher.dispatchEvent(new StartShareRequestFailedEvent()); } } - + public function handleStartSharingEvent():void { //toolbarButtonManager.disableToolbarButton(); toolbarButtonManager.startedSharing(); publishWindowManager.startSharing(module.getCaptureServerUri(), module.getRoom(), module.tunnel()); sharing = true; } - - public function handleShareScreenEvent(fullScreen:Boolean):void { - publishWindowManager.handleShareScreenEvent(fullScreen); - } - - public function handleStopSharingEvent():void { - sharing = false; - publishWindowManager.stopSharing(); - } - - public function handleRefreshScreenshareTab():void { - handleStopSharingEvent(); - } public function handleShareWindowCloseEvent():void { //toolbarButtonManager.enableToolbarButton(); @@ -216,11 +208,11 @@ package org.bigbluebutton.modules.screenshare.managers { sharing = false; toolbarButtonManager.stoppedSharing(); } - + public function handleViewWindowCloseEvent():void { viewWindowManager.handleViewWindowCloseEvent(); } - + public function handleUseJavaModeCommand():void { @@ -231,16 +223,5 @@ package org.bigbluebutton.modules.screenshare.managers { public function handleDeskshareToolbarStopEvent():void { toolbarButtonManager.stoppedSharing(); } - - public function handleStopViewStreamEvent():void { - viewWindowManager.stopViewing(); - if (UsersUtil.amIPresenter()) { - publishWindowManager.stopSharing(); - } - } - - public function handleVideoDisplayModeEvent(actualSize:Boolean):void { - viewWindowManager.handleVideoDisplayModeEvent(actualSize); - } } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/SmartWindowResizer.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/SmartWindowResizer.as deleted file mode 100644 index f57a6acb9e..0000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/SmartWindowResizer.as +++ /dev/null @@ -1,76 +0,0 @@ -package org.bigbluebutton.modules.screenshare.managers { - public class SmartWindowResizer { - - static private var RESIZING_DIRECTION_UNKNOWN:int = 0; - static private var RESIZING_DIRECTION_VERTICAL:int = 1; - static private var RESIZING_DIRECTION_HORIZONTAL:int = 2; - static private var RESIZING_DIRECTION_BOTH:int = 3; - private var _resizeDirection:int; - - public function SmartWindowResizer() {} - - public function onResizeStart():void { - /** - * when the window is resized by the user, the application doesn't know - * about the resize direction - */ - _resizeDirection = RESIZING_DIRECTION_UNKNOWN; - } - - public function onResizeEnd():void { - /** - * after the resize ends, the direction is set to BOTH because of the - * non-user resize actions - like when the window is docked, and so on - */ - _resizeDirection = RESIZING_DIRECTION_BOTH; - } - - public function onResize(externalWidth:int, externalHeight:int, maximized:Boolean, internalWidth:int, internalHeight:int, internalAspectRatio:Number, keepInternalAspectRatio:Boolean, callback:Function):void { - var internalWidthCandidate:int = externalWidth; - var internalHeightCandidate:int = externalHeight; - - // try to discover in which direction the user is resizing the window - if (_resizeDirection != RESIZING_DIRECTION_BOTH) { - if (internalWidthCandidate == internalWidth && internalHeightCandidate != internalHeight) { - _resizeDirection = (_resizeDirection == RESIZING_DIRECTION_VERTICAL || _resizeDirection == RESIZING_DIRECTION_UNKNOWN? RESIZING_DIRECTION_VERTICAL: RESIZING_DIRECTION_BOTH); - } else if (internalWidthCandidate != internalWidth && internalHeightCandidate == internalHeight) { - _resizeDirection = (_resizeDirection == RESIZING_DIRECTION_HORIZONTAL || _resizeDirection == RESIZING_DIRECTION_UNKNOWN? RESIZING_DIRECTION_HORIZONTAL: RESIZING_DIRECTION_BOTH); - } else { - _resizeDirection = RESIZING_DIRECTION_BOTH; - } - } - - // depending on the direction, the tmp size is different - switch (_resizeDirection) { - case RESIZING_DIRECTION_VERTICAL: - internalWidthCandidate = Math.floor(internalHeightCandidate * internalAspectRatio); - break; - case RESIZING_DIRECTION_HORIZONTAL: - internalHeightCandidate = Math.floor(internalWidthCandidate / internalAspectRatio); - break; - case RESIZING_DIRECTION_BOTH: - // this direction is used also for non-user window resize actions - internalWidthCandidate = Math.min (internalWidthCandidate, Math.floor(internalHeightCandidate * internalAspectRatio)); - internalHeightCandidate = Math.min (internalHeightCandidate, Math.floor(internalWidthCandidate / internalAspectRatio)); - break; - } - - var internalOffsetX:int; - var internalOffsetY:int; - - if (!keepInternalAspectRatio || maximized) { - // center the video in the window - internalOffsetX = Math.floor ((externalWidth - internalWidthCandidate) / 2); - internalOffsetY = Math.floor ((externalHeight - internalHeightCandidate) / 2); - } else { - // fit window dimensions on video - internalOffsetX = 0; - internalOffsetY = 0; - externalWidth = internalWidthCandidate; - externalHeight = internalHeightCandidate; - } - - callback(externalWidth, externalHeight, internalWidthCandidate, internalHeightCandidate, internalOffsetX, internalOffsetY); - } - } -} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ViewerWindowManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ViewerWindowManager.as index 6ee704fcd8..09e9d40c9d 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ViewerWindowManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/ViewerWindowManager.as @@ -28,7 +28,6 @@ package org.bigbluebutton.modules.screenshare.managers { import org.bigbluebutton.common.events.OpenWindowEvent; import org.bigbluebutton.modules.screenshare.services.ScreenshareService; import org.bigbluebutton.modules.screenshare.view.components.ScreenshareViewWindow; - import org.bigbluebutton.modules.screenshare.events.ShareEvent; public class ViewerWindowManager { private static const LOGGER:ILogger = getClassLogger(ViewerWindowManager); @@ -47,21 +46,23 @@ package org.bigbluebutton.modules.screenshare.managers { if (isViewing) viewWindow.stopViewing(); } - private function openWindow(window:ScreenshareViewWindow):void { - var e:ShareEvent = new ShareEvent(ShareEvent.OPEN_SCREENSHARE_VIEW_TAB); - e.viewTabContent = window; - globalDispatcher.dispatchEvent(e); + + private function openWindow(window:IBbbModuleWindow):void { + var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT); + event.window = window; + globalDispatcher.dispatchEvent(event); } public function handleViewWindowCloseEvent():void { LOGGER.debug("ViewerWindowManager Received stop viewing command"); - closeWindow(); + closeWindow(viewWindow); isViewing = false; } - private function closeWindow():void { - var e:ShareEvent = new ShareEvent(ShareEvent.CLOSE_SCREENSHARE_VIEW_TAB); - globalDispatcher.dispatchEvent(e); + private function closeWindow(window:IBbbModuleWindow):void { + var event:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT); + event.window = window; + globalDispatcher.dispatchEvent(event); } public function startViewing(streamId:String, videoWidth:Number, videoHeight:Number):void { @@ -72,11 +73,5 @@ package org.bigbluebutton.modules.screenshare.managers { isViewing = true; } - - public function handleVideoDisplayModeEvent(actualSize:Boolean):void{ - if (isViewing) { - viewWindow.actualSize = actualSize; - } - } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/WebRTCDeskshareManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/WebRTCDeskshareManager.as index db2e75b9a2..ebf2889051 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/WebRTCDeskshareManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/managers/WebRTCDeskshareManager.as @@ -19,8 +19,8 @@ package org.bigbluebutton.modules.screenshare.managers { - import com.asfusion.mate.events.Dispatcher; - import flash.external.ExternalInterface; + import com.asfusion.mate.events.Dispatcher; + import flash.external.ExternalInterface; import org.as3commons.lang.StringUtils; import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; @@ -33,6 +33,7 @@ package org.bigbluebutton.modules.screenshare.managers import org.bigbluebutton.modules.screenshare.events.WebRTCPublishWindowChangeState; import org.bigbluebutton.modules.screenshare.events.WebRTCViewStreamEvent; import org.bigbluebutton.modules.screenshare.model.ScreenshareOptions; + import org.bigbluebutton.modules.screenshare.view.components.WebRTCDesktopPublishWindow; import org.bigbluebutton.modules.screenshare.services.WebRTCDeskshareService; import org.bigbluebutton.modules.screenshare.utils.BrowserCheck; @@ -138,6 +139,7 @@ package org.bigbluebutton.modules.screenshare.managers private function initDeskshare():void { LOGGER.debug("WebRTCDeskshareManager::initDeskshare"); sharing = false; + if (!StringUtils.isEmpty(options.chromeExtensionKey)) { chromeExtensionKey = options.chromeExtensionKey; } @@ -160,6 +162,8 @@ package org.bigbluebutton.modules.screenshare.managers private function canIUseVertoOnThisBrowser(newOnWebRTCBrokeFailure:Function = null, newOnNoWebRTCFailure:Function = null, newOnSuccess:Function = null):void { LOGGER.debug("DeskshareManager::canIUseVertoOnThisBrowser"); + var options:ScreenshareOptions = new ScreenshareOptions(); + options.parseOptions(); var onNoWebRTCFailure:Function, onWebRTCBrokeFailure:Function, onSuccess:Function; onNoWebRTCFailure = (newOnNoWebRTCFailure != null) ? newOnNoWebRTCFailure : function(message:String):void { @@ -186,7 +190,7 @@ package org.bigbluebutton.modules.screenshare.managers if (BrowserCheck.isFirefox()) { onSuccess("Firefox, lets try"); } else { - if (!StringUtils.isEmpty(chromeExtensionKey)) { + if (chromeExtensionKey != null) { LOGGER.debug("WebRTCDeskshareManager::handleStartSharingEvent chrome extension link exists - "); if (ExternalInterface.available) { @@ -242,6 +246,7 @@ package org.bigbluebutton.modules.screenshare.managers if(isPresenter && usingWebRTC) { publishWindowManager.startViewing(e.rtmp, e.videoWidth, e.videoHeight); } else { + if (!options.tryWebRTCFirst || e == null || e.rtmp == null) { return; } @@ -273,7 +278,7 @@ package org.bigbluebutton.modules.screenshare.managers var dispatcher:Dispatcher = new Dispatcher(); dispatcher.dispatchEvent(new WebRTCViewStreamEvent(WebRTCViewStreamEvent.START)); } - + /*public function handleIsSharingScreenEvent(event: IsSharingScreenEvent):void {*/ public function handleIsSharingScreenEvent():void { if (UsersUtil.amIPresenter()) { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/ScreenshareEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/ScreenshareEventMap.mxml index c7e454c129..1305882eef 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/ScreenshareEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/ScreenshareEventMap.mxml @@ -1,165 +1,164 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/WebRTCDeskshareEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/WebRTCDeskshareEventMap.mxml index ed0926bb1f..8e0509dbf6 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/WebRTCDeskshareEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/maps/WebRTCDeskshareEventMap.mxml @@ -1,141 +1,141 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/model/ScreenshareOptions.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/model/ScreenshareOptions.as index dbea898288..3bb523d36c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/model/ScreenshareOptions.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/model/ScreenshareOptions.as @@ -1,46 +1,46 @@ -/** - * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ - * - * Copyright (c) 2012 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 3.0 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.screenshare.model { - import org.bigbluebutton.core.Options; - - public class ScreenshareOptions extends Options { - - [Bindable] - public var showButton:Boolean = true; - - [Bindable] - public var baseTabIndex:int = 201; - - [Bindable] - public var tryWebRTCFirst:Boolean = false; - - [Bindable] - public var chromeExtensionLink:String = ""; - - [Bindable] - public var chromeExtensionKey:String = ""; - - [Bindable] - public var help:String = ""; - - public function ScreenshareOptions():void { - name = "ScreenshareModule"; - } - } -} +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2012 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 3.0 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.screenshare.model { + import org.bigbluebutton.core.Options; + + public class ScreenshareOptions extends Options { + + [Bindable] + public var showButton:Boolean = true; + + [Bindable] + public var baseTabIndex:int = 201; + + [Bindable] + public var tryWebRTCFirst:Boolean = false; + + [Bindable] + public var chromeExtensionLink:String = ""; + + [Bindable] + public var chromeExtensionKey:String = ""; + + [Bindable] + public var help:String = ""; + + public function ScreenshareOptions():void { + name = "ScreenshareModule"; + } + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreensharePublishWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreensharePublishWindow.mxml index dc059d40e7..c9e43e1197 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreensharePublishWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreensharePublishWindow.mxml @@ -20,74 +20,80 @@ with BigBlueButton; if not, see . --> - - - - - - - - - - - - - - - - - + width="700" height="350" + title="{ResourceUtil.getInstance().getString('bbb.screensharePublish.title')}" + resizable="false"> + + + + + + + + + + + + + + + + . private var captureHeight:Number = Capabilities.screenResolutionY; private var captureWidth:Number = Capabilities.screenResolutionX; private var globalDispatcher:Dispatcher = new Dispatcher(); - + [Bindable] private var baseIndex:int; [Bindable] private var dsOptions:ScreenshareOptions; - + private var paused:Boolean = false; - + private var os:String; private var browser:String; - + [Bindable] private var shareTypeProvider:Array; - + private function init():void { - dsOptions = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; + dsOptions = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; baseIndex = dsOptions.baseTabIndex; } - + private function onCreationComplete():void { var fullOS:String = Capabilities.os; if (fullOS.indexOf("Windows") != -1) { @@ -125,81 +131,81 @@ with BigBlueButton; if not, see . LOGGER.error("Browser not recognized, full value: {0}", [fullOS]); os = ""; } - + browser = ExternalInterface.call("determineBrowser")[0]; - - //windowControls.maximizeRestoreBtn.enabled = false; - - //titleBarOverlay.tabIndex = dsOptions.baseTabIndex; - //titleBarOverlay.focusEnabled = true; - + + windowControls.maximizeRestoreBtn.enabled = false; + + titleBarOverlay.tabIndex = dsOptions.baseTabIndex; + titleBarOverlay.focusEnabled = true; + resourcesChanged(); - - //focusManager.setFocus(titleBarOverlay); - + + focusManager.setFocus(titleBarOverlay); + if (tunnel) { helpInfoBox.visible = helpInfoBox.includeInLayout = false; - //previewBox.visible = previewBox.includeInLayout = false; + previewBox.visible = previewBox.includeInLayout = false; tunnelBox.visible = tunnelBox.includeInLayout = true; - + shareTypeBox.visible = false; cancelBtn.visible = cancelBtn.includeInLayout = true; startBtn.visible = startBtn.includeInLayout = false; - //stopBtn.visible = stopBtn.includeInLayout = false; + stopBtn.visible = stopBtn.includeInLayout = false; } } - + private function remoteFocus(e:ShortcutEvent):void{ - //focusManager.setFocus(minimizeBtn); + focusManager.setFocus(minimizeBtn); } - + public function get defaultWidth():int{ return this.width; } - + public function get defaultHeight():int{ return this.height; } - + public function set defaultHeight(height:int):void{ this.height = height; } - + public function set defaultWidth(width:int):void{ this.width = width; } - + public function getPrefferedPosition():String{ return MainCanvas.DESKTOP_SHARING_PUBLISH; } - + public function handleDisconnectedEvent(event:BBBEvent):void { if (event.payload.type == ReconnectionManager.DESKSHARE_CONNECTION) { - closeWindow(); + closeWindow(); } } - + /* * Implement resizeable interface. */ public function resetWidthAndHeight():void{/* do nothing */} - + public function initWindow(connection:Connection, uri:String, room:String, tunnel:Boolean):void { this.connection = connection; this.uri = uri; this.room = room; this.tunnel = tunnel; } - + private function handleStartShareRequestSuccessEvent(event:StartShareRequestSuccessEvent):void { - + } - + private function handleScreenShareShareStoppedEvent(event:ShareStoppedEvent):void { LOGGER.debug("handleScreenShareShareStoppedEvent reason="+event.reason); - + var showReason:Boolean = false; - + if (event.reason == "JWS_START_FAILED_REASON") { showReason = true; if (paused) { @@ -211,25 +217,25 @@ with BigBlueButton; if not, see . showReason = true; jwsCrashedLbl.visible = jwsCrashedLbl.includeInLayout = true; } - + if (showReason) { helpInfoBox.visible = helpInfoBox.includeInLayout = false; - //previewBox.visible = previewBox.includeInLayout = false; + previewBox.visible = previewBox.includeInLayout = false; errorBox.visible = errorBox.includeInLayout = true; - + shareTypeBox.visible = false; - //cancelBtn.visible = cancelBtn.includeInLayout = true; + cancelBtn.visible = cancelBtn.includeInLayout = true; startBtn.visible = startBtn.includeInLayout = false; - //stopBtn.visible = stopBtn.includeInLayout = false; + stopBtn.visible = stopBtn.includeInLayout = false; } else { closeWindow(); } } -/* + private function handleScreenSharePausedEvent(event:ScreenSharePausedEvent):void { if (videoWrapper != null && video != null && video.parent == videoWrapper) { videoWrapper.removeChild(video); - + if (paused) { LOGGER.debug("handleScreenSharePausedEvent - enable push button."); pauseBtn.enabled = true; @@ -242,7 +248,7 @@ with BigBlueButton; if not, see . } } } -*/ + public function shareScreen(fullScreen:Boolean):void { LOGGER.debug("Calling shareScreen"); startBtn.enabled = false; @@ -250,7 +256,7 @@ with BigBlueButton; if not, see . dispatchEvent(shareStartEvent); startSharing(connection.getConnection(), uri, room, fullScreen); } - + private function startSharing(connection:NetConnection, uri:String, room:String, fullScreen:Boolean):void { var captureX:Number = 0; var captureY:Number = 0; @@ -260,22 +266,22 @@ with BigBlueButton; if not, see . LOGGER.debug("StartScreensharing jnlp=" + jnlp + " token=" + authToken); ExternalInterface.call("startScreensharing", jnlp, UsersUtil.getInternalMeetingID(), authToken, fullScreen); } - + public function stopSharing():void { LOGGER.debug("Calling stopSharing"); if (streaming) { stopStream(); } - + var streamEvent:RequestToStopSharing = new RequestToStopSharing(); dispatchEvent(streamEvent); - + sharingFullScreen = false; streaming = false; - + //closeWindow(); } -/* + public function pauseSharing():void { LOGGER.debug("Calling pauseSharing"); if (!paused) { @@ -287,73 +293,73 @@ with BigBlueButton; if not, see . } sharingFullScreen = false; streaming = false; - + pauseBtn.enabled = false; } else { paused = false; - + restartBtn.enabled = false; - + var restartSharingEvent:RequestToRestartSharing = new RequestToRestartSharing(); dispatchEvent(restartSharingEvent); } } -*/ + public function stopSharingEvent(evt:StopSharingButtonEvent):void{ if (streaming) { stopStream(); } sharingFullScreen = false; streaming = false; - + closeWindow(); } - + private function handleStartViewStreamEvent(event:ViewStreamEvent):void{ LOGGER.debug("handleStartViewStreamEvent"); var width: int = ScreenshareModel.getInstance().width; var height: int = ScreenshareModel.getInstance().height; var streamId: String = ScreenshareModel.getInstance().streamId; - //startPreviewStream(connection.getConnection(), streamId, width, height); + startPreviewStream(connection.getConnection(), streamId, width, height); } -/* + private function startPreviewStream(nc:NetConnection, streamId:String, capWidth:Number, capHeight:Number):void{ - + switchView(false); - + LOGGER.debug("Viewing stream =[" + streamId + "]"); streaming = true; - + restartBtn.enabled = true; pauseBtn.visible = pauseBtn.includeInLayout = true; restartBtn.visible = restartBtn.includeInLayout = false; - + // Store capture dimensions so we can position cursor properly. captureWidth = capWidth; captureHeight = capHeight; - + var vidW:Number = captureWidth; var vidH:Number = captureHeight; - + // for some reason videoHolder's height is always '0' even when set to 100% so we have to do it manually videoWrapper.height = this.height - controlBar.height - this.titleBar.height - pauseBtn.height - publishView.getStyle('paddingTop') - publishView.getStyle('paddingBottom') - 10; videoWrapper.width = this.width - publishView.getStyle('paddingLeft') - publishView.getStyle('paddingRight') - 10; - + vidW = videoWrapper.width; vidH = videoWrapper.width * captureHeight / captureWidth; - + if (vidH > videoWrapper.height) { vidH = videoWrapper.height; vidW = videoWrapper.height * captureWidth / captureHeight; } - + LOGGER.debug("deskshare preview[" + captureWidth + "," + captureHeight + "][" + vidW + "," + vidH + "]"); video = new Video(vidW, vidH); - + videoWrapper.addChild(video); video.x = videoWrapper.width/2 - video.width/2; video.y = videoWrapper.height/2 - video.height/2; - + ns = new NetStream(nc); ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError); ns.addEventListener( NetStatusEvent.NET_STATUS, onNetStatus ); @@ -363,28 +369,28 @@ with BigBlueButton; if not, see . ns.receiveAudio(false); video.attachNetStream(ns); ns.play(streamId); - + pauseBox.visible = pauseBox.includeInLayout = false; videoWrapper.visible = videoWrapper.includeInLayout = true; pauseBox.width = vidW; pauseBox.height = vidH; } -*/ + public function onMetaData(info:Object):void{ LOGGER.debug("metadata: width=" + info.width + " height=" + info.height); } - + private function stopStream():void{ streaming = false; captureHeight = Capabilities.screenResolutionY; captureWidth = Capabilities.screenResolutionX; ns.close(); } - + private function onAsyncError(e:AsyncErrorEvent):void{ LOGGER.debug("VIdeoWindow::asyncerror " + e.toString()); } - + private function onNetStatus(e:NetStatusEvent):void{ switch(e.info.code){ case "NetStream.Publish.Start": @@ -399,76 +405,76 @@ with BigBlueButton; if not, see . globalDispatcher.dispatchEvent(new BBBEvent(BBBEvent.DESKSHARE_STARTED)); } } - + private function onChangedPresenter(e:Event):void{ stopSharing(); closeWindow(); } - + private function closeWindow():void { dispatchEvent(new ShareWindowEvent(ShareWindowEvent.CLOSE)); } - + private function restartJava():void { shareScreen(sharingFullScreen); } - - + + /* * Override the close handler. We want the Event Map to send a message to * the MDIManager to close this window; */ -/* override public function close(event:MouseEvent = null):void { stopSharing(); closeWindow(); } -*/ + override protected function resourcesChanged():void{ super.resourcesChanged(); -/* this.title = ResourceUtil.getInstance().getString('bbb.screensharePublish.title'); - + if (titleBarOverlay != null) { titleBarOverlay.accessibilityName = ResourceUtil.getInstance().getString('bbb.screensharePublish.title'); } - + if (windowControls != null) { minimizeBtn.toolTip = ResourceUtil.getInstance().getString('bbb.screensharePublish.minimizeBtn.toolTip'); minimizeBtn.accessibilityName = ResourceUtil.getInstance().getString("bbb.screensharePublish.minimizeBtn.accessibilityName"); - + maximizeRestoreBtn.toolTip = ResourceUtil.getInstance().getString('bbb.screensharePublish.maximizeRestoreBtn.toolTip'); maximizeRestoreBtn.accessibilityName = ResourceUtil.getInstance().getString("bbb.screensharePublish.maximizeRestoreBtn.accessibilityName"); - + closeBtn.toolTip = ResourceUtil.getInstance().getString('bbb.screensharePublish.closeBtn.toolTip'); closeBtn.accessibilityName = ResourceUtil.getInstance().getString("bbb.screensharePublish.closeBtn.accessibilityName"); } -*/ + shareTypeProvider = [ResourceUtil.getInstance().getString('bbb.screensharePublish.shareType.fullScreen'), ResourceUtil.getInstance().getString('bbb.screensharePublish.shareType.region')]; - + setHelpText(); } - + private function localeChanged(e:Event):void{ resourcesChanged(); } - + private function closePublishWindow(event:ViewStreamEvent):void{ stopStream(); closeWindow(); } - + private function isUsingMac():Boolean { return (Capabilities.os.indexOf("Mac") >= 0); } - + private function onHelpButtonClicked():void { - var DEFAULT_HELP_URL:String = dsOptions.help; + var option:ScreenshareOptions = new ScreenshareOptions(); + option.parseOptions(); + var DEFAULT_HELP_URL:String = dsOptions.help; LOGGER.debug("onHelpButtonClicked - " + DEFAULT_HELP_URL); navigateToURL(new URLRequest(DEFAULT_HELP_URL), "_blank") } - + private function setHelpText():void { if (helpBox != null) { var info:String = ""; @@ -503,49 +509,44 @@ with BigBlueButton; if not, see . info += "Chrome"; } } - + if (info != "") { helpImg1.styleName = "publishHelp" + info + "1"; helpLbl1.text = ResourceUtil.getInstance().getString("bbb.screensharePublish.helpText."+info+"1"); - + helpImg2.styleName = "publishHelp" + info + "2"; helpLbl2.text = ResourceUtil.getInstance().getString("bbb.screensharePublish.helpText."+info+"2"); - + helpImg3.styleName = "publishHelp" + info + "3"; helpLbl3.text = ResourceUtil.getInstance().getString("bbb.screensharePublish.helpText."+info+"3"); - + helpImg4.styleName = "publishHelp" + info + "4"; helpLbl4.text = ResourceUtil.getInstance().getString("bbb.screensharePublish.helpText."+info+"4"); } } } - + private function onStartButtonClick():void { - cancelBtn.visible = cancelBtn.includeInLayout = true; shareScreen(shareTypeCombo.selectedIndex == 0); } - + private function switchView(showHelp:Boolean):void { helpInfoBox.visible = helpInfoBox.includeInLayout = showHelp; - //previewBox.visible = !showHelp; - + previewBox.visible = !showHelp; + shareTypeBox.visible = showHelp; cancelBtn.visible = cancelBtn.includeInLayout = showHelp; startBtn.visible = startBtn.includeInLayout = showHelp; - //stopBtn.visible = stopBtn.includeInLayout = !showHelp; - } - - private function onCancelButtonClick():void { - dispatchEvent(new ShareEvent(ShareEvent.REFRESH_SCREENSHARE_PUBLISH_TAB)); + stopBtn.visible = stopBtn.includeInLayout = !showHelp; } ]]> - - - - - - + + + + + + @@ -554,14 +555,14 @@ with BigBlueButton; if not, see . text="{ResourceUtil.getInstance().getString('bbb.screensharePublish.commonHelpText.text')}" /> - + @@ -578,9 +579,9 @@ with BigBlueButton; if not, see . - + - + @@ -616,7 +617,7 @@ with BigBlueButton; if not, see . - - + + - + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreenshareViewWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreenshareViewWindow.mxml index 25d7386927..685f07f891 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreenshareViewWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ScreenshareViewWindow.mxml @@ -20,73 +20,72 @@ --> - + - - - - - + + + + + + + private var streamAvailable:Boolean = false; - + private var video:Video; private var ns:NetStream; - private var videoWithWarnings:VideoWithWarnings = new VideoWithWarnings(); - private var videoHolder:UIComponent; + private var videoHolder:UIComponent = new UIComponent(); private var streamId:String; private var videoHeight:Number = 1; private var videoWidth:Number = 1; - private var loaded:Boolean = false; - + private static const VIDEO_WIDTH_PADDING:int = 7; private static const VIDEO_HEIGHT_PADDING:int = 65; - [Bindable] private var _actualSize:Boolean = false; - private var resizer:SmartWindowResizer = new SmartWindowResizer(); - - private var whiteboardCanvas:WhiteboardCanvas = null; - - // The following code block is to deal with a bug in FLexLib + // The following code block is to deal with a bug in FLexLib // with MDI windows not responding well to being maximized private var savedWindowWidth:Number; private var savedWindowHeight:Number; @@ -94,78 +93,72 @@ private var savedY:Number; private var isMaximized:Boolean = false; private var connection:Connection; - + [Bindable] private var baseIndex:int; [Bindable] private var dsOptions:ScreenshareOptions; - + private function init():void{ dsOptions = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; baseIndex = dsOptions.baseTabIndex; } - + private function onCreationComplete():void{ viewScreenshareStream(); - - addEventListener(ResizeEvent.RESIZE, onResizeEvent); - this.addChildAt(videoWithWarnings,0); - videoHolder = videoWithWarnings.videoHolder; + + videoHolder.addChild(video); + this.addChild(videoHolder); videoHolder.percentWidth = 100; videoHolder.percentHeight = 100; - //addEventListener(MDIWindowEvent.RESIZE_END, onResizeEndEvent); - //fitToActualSize(); - //maximize(); - + addEventListener(MDIWindowEvent.RESIZE_END, onResizeEndEvent); + fitToActualSize(); + maximize(); + resourcesChanged(); - onResizeEvent(); - loaded = true; - //titleBarOverlay.tabIndex = baseIndex; - //minimizeBtn.tabIndex = baseIndex+1; - //maximizeRestoreBtn.tabIndex = baseIndex+2; - //closeBtn.tabIndex = baseIndex+3; + + titleBarOverlay.tabIndex = baseIndex; + minimizeBtn.tabIndex = baseIndex+1; + maximizeRestoreBtn.tabIndex = baseIndex+2; + closeBtn.tabIndex = baseIndex+3; var logData:Object = UsersUtil.initLogData(); logData.tags = ["screenshare"]; logData.width = videoWidth; logData.height = videoHeight; logData.streamId = streamId; - + LOGGER.info(JSON.stringify(logData)); } - - private function onResizeEvent(e:ResizeEvent = null):void { - if (!loaded) return; - LOGGER.debug("ScreenshareViewWindow::onResizeEvent"); - if (actualSize) { - onResizeCallback(this.width, this.height, videoWidth, videoHeight, Math.max((this.width - videoWidth) / 2, 0), Math.max((this.height - videoHeight) / 2, 0)); - } else { - resizer.onResize(this.width, this.height, false, video.width, video.height, videoWidth / videoHeight, false, onResizeCallback); + + private function onResizeEndEvent(event:MDIWindowEvent):void { + if (event.window == this && streamAvailable) { + fitToWindow(); } } - + public function startVideo(connection:Connection):void{ var logData:Object = new Object(); logData.width = ScreenshareModel.getInstance().width; logData.height = ScreenshareModel.getInstance().height; logData.streamId = ScreenshareModel.getInstance().streamId; - + JSLog.debug(LOG + "startVideo", logData); - + this.connection = connection; } - + private function viewScreenshareStream():void{ videoWidth = ScreenshareModel.getInstance().width; videoHeight = ScreenshareModel.getInstance().height; streamId = ScreenshareModel.getInstance().streamId; - + var logData:Object = UsersUtil.initLogData(); logData.tags = ["screenshare"]; logData.width = videoWidth; logData.height = videoHeight; logData.streamId = streamId; - + LOGGER.info(JSON.stringify(logData)); - + ns = new NetStream(connection.getConnection()); ns.addEventListener( NetStatusEvent.NET_STATUS, onNetStatus ); ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError); @@ -173,82 +166,35 @@ ns.bufferTime = 0; ns.receiveVideo(true); ns.receiveAudio(false); - + video = new Video(videoWidth, videoHeight); video.width = videoWidth; video.height = videoHeight; video.smoothing = true; video.attachNetStream(ns); - ns.play(streamId); - //this.title = "Viewing Remote Desktop"; + ns.play(streamId); + this.title = "Viewing Remote Desktop"; streamAvailable = true; - videoWithWarnings.setCallback(setVideo); + fitToWindow(); } - + public function onMetaData(info:Object):void{ trace("metadata: width=" + info.width + " height=" + info.height); - + var logData:Object = UsersUtil.initLogData(); logData.tags = ["screenshare"]; logData.width = info.width; logData.height = info.height; - + LOGGER.info(JSON.stringify(logData)); } - - public function onParentResized(width:Number, height:Number):void { - onResizeEvent(); - } - - private function onResizeCallback(externalWidth:int, externalHeight:int, internalWidth:int, internalHeight:int, internalOffsetX:int, internalOffsetY:int):void { - if(videoHolder != null) { - /* Reposition video within window */ - videoWithWarnings.x = internalOffsetX; - videoWithWarnings.y = internalOffsetY; - - videoWithWarnings.width = video.width = internalWidth; - videoWithWarnings.height = video.height = internalHeight; - - // update the whiteboard canvas holder and overlay with new video dimensions - updateWhiteboardCanvasOverlay(); - } - } - - private function setVideo():void { - LOGGER.debug("Callback called. Adding video, its whiteboard canvas and resizing components..."); - videoHolder.addChild(video); - addWhiteboardCanvasOverlay(); - onResizeEvent(); - } - - public function addWhiteboardCanvasOverlay():void { - updateWhiteboardCanvasOverlay(); - if (video != null && whiteboardCanvas != null && videoHolder != null) { - this.addChild(whiteboardCanvas as Canvas); - LOGGER.debug("Whiteboard Canvas OVERLAY added."); - } - else { - LOGGER.error("COULD NOT add whiteboard overlay"); - } - } - - private function updateWhiteboardCanvasOverlay():void{ - if (video != null && whiteboardCanvas != null && videoHolder != null) { - whiteboardCanvas.moveCanvas(videoWithWarnings.x, videoWithWarnings.y); - - whiteboardCanvas.zoomCanvas(videoWithWarnings.width, videoWithWarnings.height); - - LOGGER.debug("Whiteboard canvas overlay dimensions updated"); - } - } -/* protected function updateButtonsPosition():void { if (this.width < bottomBar.width) { bottomBar.visible = false; } - + if (bottomBar.visible == false) { bottomBar.y = bottomBar.x = 0; } else { @@ -256,16 +202,16 @@ bottomBar.x = (this.width - bottomBar.width) / 2; } } -*/ + public function stopViewing():void { ns.close(); - closeWindow(); + closeWindow(); } - + private function onStopViewStreamEvent(event:ViewStreamEvent):void { stopViewing(); } - + private function onAsyncError(e:AsyncErrorEvent):void{ LOGGER.debug("asyncerror " + e.toString()); var logData:Object = UsersUtil.initLogData(); @@ -273,12 +219,12 @@ logData.message = "asyncerror"; LOGGER.info(JSON.stringify(logData)); } - + private function onNetStatus(e:NetStatusEvent):void{ var logData:Object = UsersUtil.initLogData(); logData.tags = ["screenshare"]; logData.stream = streamId; - + switch(e.info.code){ case "NetStream.Play.Start": logData.message = "NetStream.Publish.Start for broadcast stream " + streamId; @@ -291,49 +237,138 @@ break; } } - - private function toggleActualSize():void { - actualSize = !actualSize; + + public function getPrefferedPosition():String{ + return MainCanvas.DESKTOP_SHARING_VIEW; } - - public function set actualSize(value:Boolean):void { - _actualSize = value; - onResizeEvent(); + + /** + * resizes the desktop sharing video to fit to this window + */ + private function fitToWindow():void { + if (!streamAvailable) + return; + + if (videoIsSmallerThanWindow()) { + fitWindowToVideo(); + } + + // Ignore if we are displaying the actual size of the video + if (!btnActualSize.selected) { + fitVideoToWindow(); + } + } + + + private function fitVideoToWindow():void { + if (this.width < this.height) { + fitToWidthAndAdjustHeightToMaintainAspectRatio(); + } else { + fitToHeightAndAdjustWidthToMaintainAspectRatio(); + } } - - public function get actualSize():Boolean { - return _actualSize; + + private function fitWindowToVideo():void { + video.width = videoWidth; + videoHolder.width = videoWidth; + video.height = videoHeight; + videoHolder.height = videoHeight; + this.height = videoHeight + VIDEO_HEIGHT_PADDING; + this.width = videoWidth + VIDEO_WIDTH_PADDING; } - + + private function videoIsSmallerThanWindow():Boolean { + return (videoHeight < this.height) && (videoWidth < this.width); + } + + + private function fitToWidthAndAdjustHeightToMaintainAspectRatio():void { + video.width = this.width - VIDEO_WIDTH_PADDING; + videoHolder.width = video.width; + // Maintain aspect-ratio + video.height = (videoHeight * video.width) / videoWidth; + videoHolder.height = video.height; + this.height = video.height + VIDEO_HEIGHT_PADDING; + } + + private function fitToHeightAndAdjustWidthToMaintainAspectRatio():void { + video.height = this.height - VIDEO_HEIGHT_PADDING; + videoHolder.height = video.height; + // Maintain aspect-ratio + video.width = (videoWidth * video.height) / videoHeight; + videoHolder.width = video.width; + this.width = video.width + VIDEO_WIDTH_PADDING; + } + + /** + * resizes the desktop sharing video to actual video resolution + */ + private function fitToActualSize():void{ + if (videoIsSmallerThanWindow()) { + fitWindowToVideo(); + } else { + video.width = videoWidth; + videoHolder.width = videoWidth; + video.height = videoHeight; + videoHolder.height = videoHeight; + } + } + + private function determineHowToDisplayVideo():void { + if (btnActualSize.selected) { + fitToActualSize(); + btnActualSize.toolTip = ResourceUtil.getInstance().getString('bbb.screenshareView.fitToWindow'); + btnActualSize.label = ResourceUtil.getInstance().getString('bbb.screenshareView.fitToWindow'); + } else { + fitToWindow(); + btnActualSize.toolTip = ResourceUtil.getInstance().getString('bbb.screenshareView.actualSize'); + btnActualSize.label = ResourceUtil.getInstance().getString('bbb.screenshareView.actualSize'); + } + } + private function closeWindow():void { dispatchEvent(new ViewWindowEvent(ViewWindowEvent.CLOSE)); } - + override protected function resourcesChanged():void{ super.resourcesChanged(); + this.title = ResourceUtil.getInstance().getString('bbb.screenshareView.title'); + + if (windowControls != null) { + minimizeBtn.toolTip = ResourceUtil.getInstance().getString("bbb.window.minimizeBtn.toolTip"); + minimizeBtn.accessibilityName = ResourceUtil.getInstance().getString("bbb.screenshareView.minimizeBtn.accessibilityName"); + + maximizeRestoreBtn.toolTip = ResourceUtil.getInstance().getString("bbb.window.maximizeRestoreBtn.toolTip"); + maximizeRestoreBtn.accessibilityName = ResourceUtil.getInstance().getString("bbb.screenshareView.maximizeRestoreBtn.accessibilityName"); + + closeBtn.toolTip = ResourceUtil.getInstance().getString("bbb.window.closeBtn.toolTip"); + closeBtn.accessibilityName = ResourceUtil.getInstance().getString("bbb.screenshareView.closeBtn.accessibilityName"); + } } - + private function localeChanged(e:Event):void{ resourcesChanged(); } - public function acceptOverlayCanvas(overlay:WhiteboardCanvas):void { - LOGGER.debug("ScreenshareViewWindow: acceptOverlayCanvas"); - whiteboardCanvas = overlay; - whiteboardCanvas.displayWhiteboardById("deskshare"); - } - - public function removeOverlayCanvas():void { - whiteboardCanvas = null; - } - - public function handleDisconnectedEvent(event:BBBEvent):void { - if (event.payload.type == ReconnectionManager.DESKSHARE_CONNECTION) { - closeWindow(); - } - } - + public function handleDisconnectedEvent(event:BBBEvent):void { + if (event.payload.type == ReconnectionManager.DESKSHARE_CONNECTION) { + closeWindow(); + } + } ]]> - + - + + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ToolbarButton.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ToolbarButton.mxml index 60342a7dea..963ee6bf30 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ToolbarButton.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/ToolbarButton.mxml @@ -21,8 +21,8 @@ with BigBlueButton; if not, see . --> . mouseOver = "mouseOverHandler(event)" mouseOut = "mouseOutHandler(event)" implements="org.bigbluebutton.common.IBbbToolbarComponent"> - - - - - - + + + + + + . import org.bigbluebutton.modules.screenshare.events.RequestToStopSharing; import org.bigbluebutton.modules.screenshare.events.ShareWindowEvent; import org.bigbluebutton.util.i18n.ResourceUtil; - + public const OFF_STATE:Number = 0; public const ON_STATE:Number = 1; - + public const STOP_SHARING:Number = 0; public const START_SHARING:Number = 1; - - private var _currentState:Number = OFF_STATE; + + private var _currentState:Number = OFF_STATE; private var dispatcher:Dispatcher = new Dispatcher(); - + public function deskshareStatus(status:Number):void { if(status == START_SHARING) { _currentState = ON_STATE; @@ -70,14 +70,14 @@ with BigBlueButton; if not, see . this.toolTip = ResourceUtil.getInstance().getString('bbb.toolbar.deskshare.toolTip.start'); styleName="deskshareDefaultButtonStyle" } - + } - + public function remoteClick(e:ShortcutEvent):void{ requestToStarSharing(); dispatchEvent(new ShortcutEvent(ShortcutEvent.REMOTE_FOCUS_DESKTOP)); } - + private function requestToStarSharing():void { if(_currentState == OFF_STATE) { this.selected = true; @@ -100,31 +100,31 @@ with BigBlueButton; if not, see . public function stopDeskshare():void { styleName="deskshareDefaultButtonStyle" } - + private function mouseOverHandler(event:MouseEvent):void { if(_currentState == ON_STATE) styleName="deskshareOffButtonStyle" else styleName="deskshareOnButtonStyle" } - + private function mouseOutHandler(event:MouseEvent):void { if(_currentState == ON_STATE) styleName="deskshareOnButtonStyle" - else + else styleName="deskshareDefaultButtonStyle" } - - - + + + public function getAlignment():String{ return MainToolbar.ALIGN_LEFT; } - + public function theory():String{ return "Screenshare button"; } - + // Moves focus back to the toolbar button when the desktop sharing window closes, for accessibility public function closeFocus(e:ShareWindowEvent):void{ this.setFocus(); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/VideoWithWarnings.as b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/VideoWithWarnings.as deleted file mode 100755 index b94aed4262..0000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/VideoWithWarnings.as +++ /dev/null @@ -1,46 +0,0 @@ -package org.bigbluebutton.modules.screenshare.view.components -{ - import mx.events.FlexEvent; - import mx.core.UIComponent; - - import org.as3commons.logging.api.ILogger; - import org.as3commons.logging.api.getClassLogger; - import org.bigbluebutton.util.i18n.ResourceUtil; - import org.bigbluebutton.main.views.VideoWithWarningsBase; - import org.bigbluebutton.core.UsersUtil; - - public class VideoWithWarnings extends VideoWithWarningsBase { - - private static const LOGGER:ILogger = getClassLogger(VideoWithWarnings); - - private var callback:Function = null; - - public function VideoWithWarnings() { - super(); - this.addEventListener(FlexEvent.CREATION_COMPLETE , creationCompleteHandler); - } - - private function creationCompleteHandler(e:FlexEvent):void { - if(callback != null) { - callback(); - if(UsersUtil.amIPresenter()) - setWarning(); - } - } - - private function setWarning():void { - _text.setStyle("styleName", "deskshareWarningLabelStyle"); - _text.text = ResourceUtil.getInstance().getString('bbb.screensharePublish.sharingMessage'); - _text.visible = true; - _textBackground.setStyle("styleName", "deskshareWarningBackgroundStyle"); - } - - public function setCallback(callback:Function):void { - this.callback = callback; - } - - public function get videoHolder():UIComponent { - return _videoHolder; - } - } -} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopPublishWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopPublishWindow.mxml index 28027648b5..ca46b75af1 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopPublishWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopPublishWindow.mxml @@ -41,16 +41,16 @@ with BigBlueButton; if not, see . - - - + + + . } private function init():void { + dsOptions = new ScreenshareOptions(); dsOptions = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; - dsOptions.parseOptions(); } private function onCreationComplete():void { @@ -208,7 +208,7 @@ with BigBlueButton; if not, see . private function startSharing(connection:NetConnection, uri:String , useTLS:Boolean , room:String, fullScreen:Boolean):void { var captureX:Number = 0; var captureY:Number = 0; - + } public function stopSharing():void{ @@ -233,7 +233,7 @@ with BigBlueButton; if not, see . var meetingUrl:String = rtmp.substring(0, rtmp.lastIndexOf('/')); stream = rtmp.substring(rtmp.lastIndexOf('/')+1, rtmp.length); LOGGER.debug("WebRTCDesktopPublishWindow::startVideo meetingurl=[{0}] and stream=[{1}]",[meetingUrl, stream]); - + JSLog.warn("WebRTCDesktopPublishWindow::startVideo meetingurl= ",meetingUrl); JSLog.warn("WebRTCDesktopPublishWindow::startVideo stream=", stream); @@ -339,7 +339,7 @@ with BigBlueButton; if not, see . btnClosePublish.enabled = true; } - private function stopStream():void{ + private function stopStream():void{ streaming = false; captureHeight = Capabilities.screenResolutionY; captureWidth = Capabilities.screenResolutionX; @@ -418,61 +418,60 @@ with BigBlueButton; if not, see . + tabIndices="{[minimizeBtn, maximizeRestoreBtn, closeBtn, btnClosePublish]}"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopViewWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopViewWindow.mxml index a7173ff909..ac0ce842a3 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopViewWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/screenshare/view/components/WebRTCDesktopViewWindow.mxml @@ -21,8 +21,8 @@ with BigBlueButton; if not, see . --> . title="{ResourceUtil.getInstance().getString('bbb.screenshareView.title')}" showCloseButton="false" resize="fitToWindow()" > + + + + + - - - - - - + . [Bindable] private var dsOptions:ScreenshareOptions; private function init():void{ - dsOptions = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; + dsOptions = Options.getOptions(ScreenshareOptions) as ScreenshareOptions; } private function displayVideo():void{ @@ -375,11 +373,11 @@ with BigBlueButton; if not, see . } ]]> - - - - - + + + + +