|
@@ -7,6 +7,7 @@ var StreamEventTypes = require("./service/RTC/StreamEventTypes");
|
7
|
7
|
var RTCEvents = require("./service/RTC/RTCEvents");
|
8
|
8
|
var EventEmitter = require("events");
|
9
|
9
|
var JitsiConferenceEvents = require("./JitsiConferenceEvents");
|
|
10
|
+var JitsiConferenceErrors = require("./JitsiConferenceErrors");
|
10
|
11
|
var JitsiParticipant = require("./JitsiParticipant");
|
11
|
12
|
var Statistics = require("./modules/statistics/statistics");
|
12
|
13
|
var JitsiDTMFManager = require('./modules/DTMF/JitsiDTMFManager');
|
|
@@ -211,6 +212,36 @@ JitsiConference.prototype.isModerator = function () {
|
211
|
212
|
return this.room.isModerator();
|
212
|
213
|
};
|
213
|
214
|
|
|
215
|
+/**
|
|
216
|
+ * Set password for the room.
|
|
217
|
+ * @param {string} password new password for the room.
|
|
218
|
+ * @returns {Promise}
|
|
219
|
+ */
|
|
220
|
+JitsiConference.prototype.lock = function (password) {
|
|
221
|
+ if (!this.isModerator()) {
|
|
222
|
+ return Promise.reject();
|
|
223
|
+ }
|
|
224
|
+
|
|
225
|
+ var conference = this;
|
|
226
|
+ return new Promise(function (resolve, reject) {
|
|
227
|
+ conference.xmpp.lockRoom(password, function () {
|
|
228
|
+ resolve();
|
|
229
|
+ }, function (err) {
|
|
230
|
+ reject(err);
|
|
231
|
+ }, function () {
|
|
232
|
+ reject(JitsiConferenceErrors.PASSWORD_REQUIRED);
|
|
233
|
+ });
|
|
234
|
+ });
|
|
235
|
+};
|
|
236
|
+
|
|
237
|
+/**
|
|
238
|
+ * Remove password from the room.
|
|
239
|
+ * @returns {Promise}
|
|
240
|
+ */
|
|
241
|
+JitsiConference.prototype.unlock = function () {
|
|
242
|
+ return this.lock(undefined);
|
|
243
|
+};
|
|
244
|
+
|
214
|
245
|
/**
|
215
|
246
|
* Elects the participant with the given id to be the selected participant or the speaker.
|
216
|
247
|
* @param id the identifier of the participant
|
|
@@ -255,7 +286,7 @@ JitsiConference.prototype.onMemberJoined = function (jid, email, nick) {
|
255
|
286
|
var participant = new JitsiParticipant(id, this, nick);
|
256
|
287
|
this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id);
|
257
|
288
|
this.participants[id] = participant;
|
258
|
|
- this.connection.xmpp.connection.disco.info(
|
|
289
|
+ this.xmpp.connection.disco.info(
|
259
|
290
|
jid, "node", function(iq) {
|
260
|
291
|
participant._supportsDTMF = $(iq).find(
|
261
|
292
|
'>query>feature[var="urn:xmpp:jingle:dtmf:0"]').length > 0;
|
|
@@ -344,7 +375,7 @@ JitsiConference.prototype.myUserId = function () {
|
344
|
375
|
|
345
|
376
|
JitsiConference.prototype.sendTones = function (tones, duration, pause) {
|
346
|
377
|
if (!this.dtmfManager) {
|
347
|
|
- var connection = this.connection.xmpp.connection.jingle.activecall.peerconnection;
|
|
378
|
+ var connection = this.xmpp.connection.jingle.activecall.peerconnection;
|
348
|
379
|
if (!connection) {
|
349
|
380
|
logger.warn("cannot sendTones: no conneciton");
|
350
|
381
|
return;
|
|
@@ -439,6 +470,9 @@ function setupListeners(conference) {
|
439
|
470
|
conference.eventEmitter.emit(JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
|
440
|
471
|
lastNEndpoints, endpointsEnteringLastN);
|
441
|
472
|
});
|
|
473
|
+ conference.xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, function () {
|
|
474
|
+ conference.eventEmitter.emit(JitsiConferenceErrors.PASSWORD_REQUIRED);
|
|
475
|
+ });
|
442
|
476
|
|
443
|
477
|
if(conference.statistics) {
|
444
|
478
|
//FIXME: Maybe remove event should not be associated with the conference.
|