|
|
@@ -1,4 +1,4 @@
|
|
1
|
|
-/* global Strophe, $ */
|
|
|
1
|
+/* global Strophe, $, Promise */
|
|
2
|
2
|
/* jshint -W101 */
|
|
3
|
3
|
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
|
4
|
4
|
var RTC = require("./modules/RTC/RTC");
|
|
|
@@ -52,6 +52,13 @@ JitsiConference.prototype.join = function (password) {
|
|
52
|
52
|
this.room.join(password, this.connection.tokenPassword);
|
|
53
|
53
|
};
|
|
54
|
54
|
|
|
|
55
|
+/**
|
|
|
56
|
+ * Check if joined to the conference.
|
|
|
57
|
+ */
|
|
|
58
|
+JitsiConference.prototype.isJoined = function () {
|
|
|
59
|
+ return this.room && this.room.joined;
|
|
|
60
|
+};
|
|
|
61
|
+
|
|
55
|
62
|
/**
|
|
56
|
63
|
* Leaves the conference.
|
|
57
|
64
|
*/
|
|
|
@@ -61,6 +68,40 @@ JitsiConference.prototype.leave = function () {
|
|
61
|
68
|
this.room = null;
|
|
62
|
69
|
};
|
|
63
|
70
|
|
|
|
71
|
+/**
|
|
|
72
|
+ * Returns name of this conference.
|
|
|
73
|
+ */
|
|
|
74
|
+JitsiConference.prototype.getName = function () {
|
|
|
75
|
+ return this.options.name;
|
|
|
76
|
+};
|
|
|
77
|
+
|
|
|
78
|
+/**
|
|
|
79
|
+ * Check if external authentication is enabled for this conference.
|
|
|
80
|
+ */
|
|
|
81
|
+JitsiConference.prototype.isExternalAuthEnabled = function () {
|
|
|
82
|
+ return this.room && this.room.moderator.isExternalAuthEnabled();
|
|
|
83
|
+};
|
|
|
84
|
+
|
|
|
85
|
+/**
|
|
|
86
|
+ * Get url for external authentication.
|
|
|
87
|
+ * @param {boolean} [urlForPopup] if true then return url for login popup,
|
|
|
88
|
+ * else url of login page.
|
|
|
89
|
+ * @returns {Promise}
|
|
|
90
|
+ */
|
|
|
91
|
+JitsiConference.prototype.getExternalAuthUrl = function (urlForPopup) {
|
|
|
92
|
+ return new Promise(function (resolve, reject) {
|
|
|
93
|
+ if (!this.isExternalAuthEnabled()) {
|
|
|
94
|
+ reject();
|
|
|
95
|
+ return;
|
|
|
96
|
+ }
|
|
|
97
|
+ if (urlForPopup) {
|
|
|
98
|
+ this.room.moderator.getPopupLoginUrl(resolve, reject);
|
|
|
99
|
+ } else {
|
|
|
100
|
+ this.room.moderator.getLoginUrl(resolve, reject);
|
|
|
101
|
+ }
|
|
|
102
|
+ }.bind(this));
|
|
|
103
|
+};
|
|
|
104
|
+
|
|
64
|
105
|
/**
|
|
65
|
106
|
* Returns the local tracks.
|
|
66
|
107
|
*/
|
|
|
@@ -267,7 +308,7 @@ JitsiConference.prototype.lock = function (password) {
|
|
267
|
308
|
}, function (err) {
|
|
268
|
309
|
reject(err);
|
|
269
|
310
|
}, function () {
|
|
270
|
|
- reject(JitsiConferenceErrors.PASSWORD_REQUIRED);
|
|
|
311
|
+ reject(JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED);
|
|
271
|
312
|
});
|
|
272
|
313
|
});
|
|
273
|
314
|
};
|
|
|
@@ -478,6 +519,18 @@ function setupListeners(conference) {
|
|
478
|
519
|
conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
|
|
479
|
520
|
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_JOINED);
|
|
480
|
521
|
});
|
|
|
522
|
+ conference.room.addListener(XMPPEvents.ROOM_JOIN_ERROR, function (pres) {
|
|
|
523
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
|
|
|
524
|
+ });
|
|
|
525
|
+ conference.room.addListener(XMPPEvents.ROOM_CONNECT_ERROR, function (pres) {
|
|
|
526
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
|
|
|
527
|
+ });
|
|
|
528
|
+ conference.room.addListener(XMPPEvents.PASSWORD_REQUIRED, function (pres) {
|
|
|
529
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.PASSWORD_REQUIRED, pres);
|
|
|
530
|
+ });
|
|
|
531
|
+ conference.room.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, function () {
|
|
|
532
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.AUTHENTICATION_REQUIRED);
|
|
|
533
|
+ });
|
|
481
|
534
|
// FIXME
|
|
482
|
535
|
// conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
|
|
483
|
536
|
// conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
|
|
|
@@ -501,7 +554,7 @@ function setupListeners(conference) {
|
|
501
|
554
|
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
|
|
502
|
555
|
});
|
|
503
|
556
|
conference.room.addListener(XMPPEvents.CONFERENCE_SETUP_FAILED, function () {
|
|
504
|
|
- conference.eventEmitter.emit(JitsiConferenceEvents.SETUP_FAILED);
|
|
|
557
|
+ conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
|
|
505
|
558
|
});
|
|
506
|
559
|
|
|
507
|
560
|
conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
|