Browse Source

added method to only authenticate user in the room

master
isymchych 9 years ago
parent
commit
013ee849f7
3 changed files with 38 additions and 8 deletions
  1. 2
    2
      JitsiConference.js
  2. 19
    4
      lib-jitsi-meet.js
  3. 17
    2
      modules/xmpp/moderator.js

+ 2
- 2
JitsiConference.js View File

@@ -330,7 +330,7 @@ JitsiConference.prototype.lock = function (password) {
330 330
 
331 331
   var conference = this;
332 332
   return new Promise(function (resolve, reject) {
333
-    conference.xmpp.lockRoom(password, function () {
333
+    conference.room.lockRoom(password || "", function () {
334 334
       resolve();
335 335
     }, function (err) {
336 336
       reject(err);
@@ -345,7 +345,7 @@ JitsiConference.prototype.lock = function (password) {
345 345
  * @returns {Promise}
346 346
  */
347 347
 JitsiConference.prototype.unlock = function () {
348
-  return this.lock(undefined);
348
+  return this.lock();
349 349
 };
350 350
 
351 351
 /**

+ 19
- 4
lib-jitsi-meet.js View File

@@ -332,7 +332,7 @@ JitsiConference.prototype.lock = function (password) {
332 332
 
333 333
   var conference = this;
334 334
   return new Promise(function (resolve, reject) {
335
-    conference.xmpp.lockRoom(password, function () {
335
+    conference.room.lockRoom(password || "", function () {
336 336
       resolve();
337 337
     }, function (err) {
338 338
       reject(err);
@@ -347,7 +347,7 @@ JitsiConference.prototype.lock = function (password) {
347 347
  * @returns {Promise}
348 348
  */
349 349
 JitsiConference.prototype.unlock = function () {
350
-  return this.lock(undefined);
350
+  return this.lock();
351 351
 };
352 352
 
353 353
 /**
@@ -10530,8 +10530,7 @@ module.exports = TraceablePeerConnection;
10530 10530
 }).call(this,"/modules/xmpp/TraceablePeerConnection.js")
10531 10531
 },{"../../service/xmpp/XMPPEvents":87,"../RTC/RTC":16,"../RTC/RTCBrowserType.js":17,"./LocalSSRCReplacement":29,"jitsi-meet-logger":48,"sdp-interop":66,"sdp-simulcast":69,"sdp-transform":76}],34:[function(require,module,exports){
10532 10532
 (function (__filename){
10533
-/* global $, $iq, APP, config, messageHandler,
10534
- roomName, sessionTerminated, Strophe, Util */
10533
+/* global $, $iq, Promise, Strophe */
10535 10534
 
10536 10535
 var logger = require("jitsi-meet-logger").getLogger(__filename);
10537 10536
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
@@ -10886,6 +10885,22 @@ Moderator.prototype.allocateConferenceFocus =  function (callback) {
10886 10885
     );
10887 10886
 };
10888 10887
 
10888
+Moderator.prototype.authenticate = function () {
10889
+    var self = this;
10890
+    return new Promise(function (resolve, reject) {
10891
+        self.connection.sendIQ(
10892
+            self.createConferenceIq(),
10893
+            function (result) {
10894
+                self.parseSessionId(result);
10895
+                resolve();
10896
+            }, function (error) {
10897
+                var code = $(error).find('>error').attr('code');
10898
+                reject(error, code);
10899
+            }
10900
+        );
10901
+    });
10902
+};
10903
+
10889 10904
 Moderator.prototype.getLoginUrl =  function (urlCallback, failureCallback) {
10890 10905
     var iq = $iq({to: this.getFocusComponent(), type: 'get'});
10891 10906
     iq.c('login-url', {

+ 17
- 2
modules/xmpp/moderator.js View File

@@ -1,5 +1,4 @@
1
-/* global $, $iq, APP, config, messageHandler,
2
- roomName, sessionTerminated, Strophe, Util */
1
+/* global $, $iq, Promise, Strophe */
3 2
 
4 3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
5 4
 var XMPPEvents = require("../../service/xmpp/XMPPEvents");
@@ -354,6 +353,22 @@ Moderator.prototype.allocateConferenceFocus =  function (callback) {
354 353
     );
355 354
 };
356 355
 
356
+Moderator.prototype.authenticate = function () {
357
+    var self = this;
358
+    return new Promise(function (resolve, reject) {
359
+        self.connection.sendIQ(
360
+            self.createConferenceIq(),
361
+            function (result) {
362
+                self.parseSessionId(result);
363
+                resolve();
364
+            }, function (error) {
365
+                var code = $(error).find('>error').attr('code');
366
+                reject(error, code);
367
+            }
368
+        );
369
+    });
370
+};
371
+
357 372
 Moderator.prototype.getLoginUrl =  function (urlCallback, failureCallback) {
358 373
     var iq = $iq({to: this.getFocusComponent(), type: 'get'});
359 374
     iq.c('login-url', {

Loading…
Cancel
Save