Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

handle incoming messages

isymchychfc76aa529340
diff --git a/app.js b/app.js
index 5b89a24dbe..1201d1700e 100644
--- a/app.js
+++ b/app.js
@@ -1,4 +1,4 @@
-/* global $, JitsiMeetJS, config, Promise */
+/* global $, JitsiMeetJS, config, interfaceConfig */
/* application specific logic */
import "babel-polyfill";
@@ -90,15 +90,11 @@ function connect() {
};
var listenForFailure = function (event) {
- handlers[event] = function () {
- // convert arguments to array
- var args = Array.prototype.slice.call(arguments);
- args.unshift(event);
- // [event, ...params]
- console.error('CONNECTION FAILED:', args);
+ handlers[event] = function (...args) {
+ console.error(`CONNECTION FAILED: ${event}`, ...args);
unsubscribe();
- reject(args);
+ reject([event, ...args]);
};
};
@@ -143,6 +139,17 @@ function initConference(connection, roomName) {
}
});
+ function getDisplayName(id) {
+ if (APP.conference.isLocalId(id)) {
+ return APP.settings.getDisplayName();
+ }
+
+ var user = users[id];
+ if (user && user.displayName) {
+ return user.displayName;
+ }
+ }
+
room.on(ConferenceEvents.USER_JOINED, function (id) {
users[id] = {
displayName: undefined,
@@ -190,13 +197,21 @@ function initConference(connection, roomName) {
});
- room.on(ConferenceEvents.CONNECTION_INTERRUPTED, function () {
- APP.UI.markVideoInterrupted(true);
- });
- room.on(ConferenceEvents.CONNECTION_RESTORED, function () {
- APP.UI.markVideoInterrupted(false);
- });
+ if (!interfaceConfig.filmStripOnly) {
+ room.on(ConferenceEvents.CONNECTION_INTERRUPTED, function () {
+ APP.UI.markVideoInterrupted(true);
+ });
+ room.on(ConferenceEvents.CONNECTION_RESTORED, function () {
+ APP.UI.markVideoInterrupted(false);
+ });
+ APP.UI.addListener(UIEvents.MESSAGE_CREATED, function (message) {
+ room.sendTextMessage(message);
+ });
+ room.on(ConferenceEvents.MESSAGE_RECEIVED, function (userId, text) {
+ APP.UI.addMessage(userId, getDisplayName(userId), text, Date.now());
+ });
+ }
APP.connectionquality.addListener(
CQEvents.LOCALSTATS_UPDATED,
@@ -259,11 +274,6 @@ function initConference(connection, roomName) {
});
- APP.UI.addListener(UIEvents.MESSAGE_CREATED, function (message) {
- room.sendTextMessage(message);
- });
-
-
room.on(ConferenceErrors.PASSWORD_REQUIRED, function () {
// FIXME handle
});
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index 6146c5f0d4..e95bf22256 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -308,10 +308,6 @@ function chatSetSubject(text) {
return Chat.chatSetSubject(text);
}
-function updateChatConversation(from, displayName, message, stamp) {
- return Chat.updateChatConversation(from, displayName, message, stamp);
-}
-
function initEtherpad(name) {
Etherpad.init(name);
}
@@ -689,4 +685,8 @@ UI.markVideoInterrupted = function (interrupted) {
}
};
+UI.addMessage = function (from, displayName, message, stamp) {
+ Chat.updateChatConversation(from, displayName, message, stamp);
+};
+
module.exports = UI;