Bläddra i källkod

added helper methods to check if auth enabled

master
isymchych 10 år sedan
förälder
incheckning
26f102a470
3 ändrade filer med 182 tillägg och 116 borttagningar
  1. 140
    106
      JitsiConference.js
  2. 38
    6
      lib-jitsi-meet.js
  3. 4
    4
      modules/xmpp/xmpp.js

+ 140
- 106
JitsiConference.js Visa fil

1
-/* global Strophe, $ */
1
+/* global Strophe, $, Promise */
2
 /* jshint -W101 */
2
 /* jshint -W101 */
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
3
 var logger = require("jitsi-meet-logger").getLogger(__filename);
4
 var RTC = require("./modules/RTC/RTC");
4
 var RTC = require("./modules/RTC/RTC");
5
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
5
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
6
+var AuthenticationEvents = require("./service/authentication/AuthenticationEvents");
6
 var RTCEvents = require("./service/RTC/RTCEvents");
7
 var RTCEvents = require("./service/RTC/RTCEvents");
7
 var EventEmitter = require("events");
8
 var EventEmitter = require("events");
8
 var JitsiConferenceEvents = require("./JitsiConferenceEvents");
9
 var JitsiConferenceEvents = require("./JitsiConferenceEvents");
10
+var JitsiConferenceErrors = require("./JitsiConferenceErrors");
9
 var JitsiParticipant = require("./JitsiParticipant");
11
 var JitsiParticipant = require("./JitsiParticipant");
10
 var Statistics = require("./modules/statistics/statistics");
12
 var Statistics = require("./modules/statistics/statistics");
11
 var JitsiDTMFManager = require('./modules/DTMF/JitsiDTMFManager');
13
 var JitsiDTMFManager = require('./modules/DTMF/JitsiDTMFManager');
30
     this.connection = this.options.connection;
32
     this.connection = this.options.connection;
31
     this.xmpp = this.connection.xmpp;
33
     this.xmpp = this.connection.xmpp;
32
     this.eventEmitter = new EventEmitter();
34
     this.eventEmitter = new EventEmitter();
33
-    this.room = this.xmpp.createRoom(this.options.name, null, null, this.options.config);
35
+    this.room = this.xmpp.createRoom(this.options.name, this.options.config);
34
     this.room.updateDeviceAvailability(RTC.getDeviceAvailability());
36
     this.room.updateDeviceAvailability(RTC.getDeviceAvailability());
35
     this.rtc = new RTC(this.room, options);
37
     this.rtc = new RTC(this.room, options);
36
     if(!RTC.options.disableAudioLevels)
38
     if(!RTC.options.disableAudioLevels)
40
     this.lastActiveSpeaker = null;
42
     this.lastActiveSpeaker = null;
41
     this.dtmfManager = null;
43
     this.dtmfManager = null;
42
     this.somebodySupportsDTMF = false;
44
     this.somebodySupportsDTMF = false;
45
+    this.authEnabled = false;
46
+    this.authIdentity;
43
 }
47
 }
44
 
48
 
45
 /**
49
 /**
51
         this.room.join(password, this.connection.tokenPassword);
55
         this.room.join(password, this.connection.tokenPassword);
52
 };
56
 };
53
 
57
 
58
+/**
59
+ * Check if joined to the conference.
60
+ */
61
+JitsiConference.prototype.isJoined = function () {
62
+    return this.room && this.room.joined;
63
+};
64
+
54
 /**
65
 /**
55
  * Leaves the conference.
66
  * Leaves the conference.
56
  */
67
  */
60
     this.room = null;
71
     this.room = null;
61
 };
72
 };
62
 
73
 
74
+/**
75
+ * Returns name of this conference.
76
+ */
77
+JitsiConference.prototype.getName = function () {
78
+    return this.options.name;
79
+};
80
+
81
+/**
82
+ * Check if authentication is enabled for this conference.
83
+ */
84
+JitsiConference.prototype.isAuthEnabled = function () {
85
+    return this.authEnabled;
86
+};
87
+
88
+/**
89
+ * Check if user is logged in.
90
+ */
91
+JitsiConference.prototype.isLoggedIn = function () {
92
+    return !!this.authIdentity;
93
+};
94
+
95
+/**
96
+ * Get authorized login.
97
+ */
98
+JitsiConference.prototype.getAuthLogin = function () {
99
+    return this.authIdentity;
100
+};
101
+
102
+/**
103
+ * Check if external authentication is enabled for this conference.
104
+ */
105
+JitsiConference.prototype.isExternalAuthEnabled = function () {
106
+    return this.room && this.room.moderator.isExternalAuthEnabled();
107
+};
108
+
109
+/**
110
+ * Get url for external authentication.
111
+ * @param {boolean} [urlForPopup] if true then return url for login popup,
112
+ *                                else url of login page.
113
+ * @returns {Promise}
114
+ */
115
+JitsiConference.prototype.getExternalAuthUrl = function (urlForPopup) {
116
+    return new Promise(function (resolve, reject) {
117
+        if (!this.isExternalAuthEnabled()) {
118
+            reject();
119
+            return;
120
+        }
121
+        if (urlForPopup) {
122
+            this.room.moderator.getPopupLoginUrl(resolve, reject);
123
+        } else {
124
+            this.room.moderator.getLoginUrl(resolve, reject);
125
+        }
126
+    }.bind(this));
127
+};
128
+
63
 /**
129
 /**
64
  * Returns the local tracks.
130
  * Returns the local tracks.
65
  */
131
  */
225
  * @param track the JitsiLocalTrack object.
291
  * @param track the JitsiLocalTrack object.
226
  */
292
  */
227
 JitsiConference.prototype.removeTrack = function (track) {
293
 JitsiConference.prototype.removeTrack = function (track) {
294
+    if(!this.room){
295
+        if(this.rtc)
296
+            this.rtc.removeLocalStream(track);
297
+        return;
298
+    }
228
     this.room.removeStream(track.getOriginalStream(), function(){
299
     this.room.removeStream(track.getOriginalStream(), function(){
229
         this.rtc.removeLocalStream(track);
300
         this.rtc.removeLocalStream(track);
230
         this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
301
         this.eventEmitter.emit(JitsiConferenceEvents.TRACK_REMOVED, track);
247
     return this.room.isModerator();
318
     return this.room.isModerator();
248
 };
319
 };
249
 
320
 
321
+/**
322
+ * Set password for the room.
323
+ * @param {string} password new password for the room.
324
+ * @returns {Promise}
325
+ */
326
+JitsiConference.prototype.lock = function (password) {
327
+  if (!this.isModerator()) {
328
+    return Promise.reject();
329
+  }
330
+
331
+  var conference = this;
332
+  return new Promise(function (resolve, reject) {
333
+    conference.xmpp.lockRoom(password, function () {
334
+      resolve();
335
+    }, function (err) {
336
+      reject(err);
337
+    }, function () {
338
+      reject(JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED);
339
+    });
340
+  });
341
+};
342
+
343
+/**
344
+ * Remove password from the room.
345
+ * @returns {Promise}
346
+ */
347
+JitsiConference.prototype.unlock = function () {
348
+  return this.lock(undefined);
349
+};
350
+
250
 /**
351
 /**
251
  * Elects the participant with the given id to be the selected participant or the speaker.
352
  * Elects the participant with the given id to be the selected participant or the speaker.
252
  * @param id the identifier of the participant
353
  * @param id the identifier of the participant
288
 
389
 
289
 JitsiConference.prototype.onMemberJoined = function (jid, email, nick) {
390
 JitsiConference.prototype.onMemberJoined = function (jid, email, nick) {
290
     var id = Strophe.getResourceFromJid(jid);
391
     var id = Strophe.getResourceFromJid(jid);
392
+    if (id === 'focus') {
393
+       return;
394
+    }
291
     var participant = new JitsiParticipant(id, this, nick);
395
     var participant = new JitsiParticipant(id, this, nick);
292
-    this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id);
293
     this.participants[id] = participant;
396
     this.participants[id] = participant;
294
-    this.connection.xmpp.connection.disco.info(
397
+    this.eventEmitter.emit(JitsiConferenceEvents.USER_JOINED, id, participant);
398
+    this.xmpp.connection.disco.info(
295
         jid, "node", function(iq) {
399
         jid, "node", function(iq) {
296
             participant._supportsDTMF = $(iq).find(
400
             participant._supportsDTMF = $(iq).find(
297
                 '>query>feature[var="urn:xmpp:jingle:dtmf:0"]').length > 0;
401
                 '>query>feature[var="urn:xmpp:jingle:dtmf:0"]').length > 0;
302
 
406
 
303
 JitsiConference.prototype.onMemberLeft = function (jid) {
407
 JitsiConference.prototype.onMemberLeft = function (jid) {
304
     var id = Strophe.getResourceFromJid(jid);
408
     var id = Strophe.getResourceFromJid(jid);
409
+    if (id === 'focus') {
410
+       return;
411
+    }
412
+    var participant = this.participants[id];
305
     delete this.participants[id];
413
     delete this.participants[id];
306
-    this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id);
414
+    this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id, participant);
307
 };
415
 };
308
 
416
 
309
 JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
417
 JitsiConference.prototype.onUserRoleChanged = function (jid, role) {
399
 
507
 
400
 JitsiConference.prototype.sendTones = function (tones, duration, pause) {
508
 JitsiConference.prototype.sendTones = function (tones, duration, pause) {
401
     if (!this.dtmfManager) {
509
     if (!this.dtmfManager) {
402
-        var connection = this.connection.xmpp.connection.jingle.activecall.peerconnection;
510
+        var connection = this.xmpp.connection.jingle.activecall.peerconnection;
403
         if (!connection) {
511
         if (!connection) {
404
             logger.warn("cannot sendTones: no conneciton");
512
             logger.warn("cannot sendTones: no conneciton");
405
             return;
513
             return;
418
     this.dtmfManager.sendTones(tones, duration, pause);
526
     this.dtmfManager.sendTones(tones, duration, pause);
419
 };
527
 };
420
 
528
 
421
-/**
422
- * Returns true if the recording is supproted and false if not.
423
- */
424
-JitsiConference.prototype.isRecordingSupported = function () {
425
-    if(this.room)
426
-        return this.room.isRecordingSupported();
427
-    return false;
428
-};
429
-
430
-/**
431
- * Returns null if the recording is not supported, "on" if the recording started
432
- * and "off" if the recording is not started.
433
- */
434
-JitsiConference.prototype.getRecordingState = function () {
435
-    if(this.room)
436
-        return this.room.getRecordingState();
437
-    return "off";
438
-}
439
-
440
-/**
441
- * Returns the url of the recorded video.
442
- */
443
-JitsiConference.prototype.getRecordingURL = function () {
444
-    if(this.room)
445
-        return this.room.getRecordingURL();
446
-    return null;
447
-}
448
-
449
-/**
450
- * Starts/stops the recording
451
- * @param token a token for authentication.
452
- */
453
-JitsiConference.prototype.toggleRecording = function (token, followEntity) {
454
-    if(this.room)
455
-        return this.room.toggleRecording(token, followEntity);
456
-    return new Promise(function(resolve, reject){
457
-        reject(new Error("The conference is not created yet!"))});
458
-}
459
-
460
-/**
461
- * Dials a number.
462
- * @param number the number
463
- */
464
-JitsiConference.prototype.dial = function (number) {
465
-    if(this.room)
466
-        return this.room.dial(number);
467
-    return new Promise(function(resolve, reject){
468
-        reject(new Error("The conference is not created yet!"))});
469
-}
470
-
471
-/**
472
- * Hangup an existing call
473
- */
474
-JitsiConference.prototype.hangup = function () {
475
-    if(this.room)
476
-        return this.room.hangup();
477
-    return new Promise(function(resolve, reject){
478
-        reject(new Error("The conference is not created yet!"))});
479
-}
480
-
481
-/**
482
- * Returns the phone number for joining the conference.
483
- */
484
-JitsiConference.prototype.getPhoneNumber = function () {
485
-    if(this.room)
486
-        return this.room.getPhoneNumber();
487
-    return null;
488
-}
489
-
490
-/**
491
- * Returns the pin for joining the conference with phone.
492
- */
493
-JitsiConference.prototype.getPhonePin = function () {
494
-    if(this.room)
495
-        return this.room.getPhonePin();
496
-    return null;
497
-}
498
-
499
-/**
500
- * Returns the connection state for the current room. Its ice connection state
501
- * for its session.
502
- */
503
-JitsiConference.prototype.getConnectionState = function () {
504
-    if(this.room)
505
-        return this.room.getConnectionState();
506
-    return null;
507
-}
508
-
509
 /**
529
 /**
510
  * Setups the listeners needed for the conference.
530
  * Setups the listeners needed for the conference.
511
  * @param conference the conference
531
  * @param conference the conference
529
     conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
549
     conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
530
         conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_JOINED);
550
         conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_JOINED);
531
     });
551
     });
552
+    conference.room.addListener(XMPPEvents.ROOM_JOIN_ERROR, function (pres) {
553
+        conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
554
+    });
555
+    conference.room.addListener(XMPPEvents.ROOM_CONNECT_ERROR, function (pres) {
556
+        conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
557
+    });
558
+    conference.room.addListener(XMPPEvents.PASSWORD_REQUIRED, function (pres) {
559
+        conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.PASSWORD_REQUIRED, pres);
560
+    });
561
+    conference.room.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, function () {
562
+        conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.AUTHENTICATION_REQUIRED);
563
+    });
532
 //    FIXME
564
 //    FIXME
533
 //    conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
565
 //    conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
534
 //        conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
566
 //        conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
548
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
580
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
549
     });
581
     });
550
 
582
 
551
-    conference.room.addListener(XMPPEvents.RECORDING_STATE_CHANGED,
552
-        function () {
553
-            conference.eventEmitter.emit(
554
-                JitsiConferenceEvents.RECORDING_STATE_CHANGED);
555
-        });
556
-
557
-    conference.room.addListener(XMPPEvents.PHONE_NUMBER_CHANGED, function () {
558
-        conference.eventEmitter.emit(
559
-            JitsiConferenceEvents.PHONE_NUMBER_CHANGED);
560
-    });
561
-
562
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
583
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
563
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
584
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
564
     });
585
     });
565
     conference.room.addListener(XMPPEvents.CONFERENCE_SETUP_FAILED, function () {
586
     conference.room.addListener(XMPPEvents.CONFERENCE_SETUP_FAILED, function () {
566
-        conference.eventEmitter.emit(JitsiConferenceEvents.SETUP_FAILED);
587
+        conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
588
+    });
589
+
590
+    conference.room.addListener(AuthenticationEvents.IDENTITY_UPDATED, function (authEnabled, authIdentity) {
591
+        conference.authEnabled = authEnabled;
592
+        conference.authIdentity = authIdentity;
593
+    });
594
+
595
+    conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
596
+        var id = Strophe.getResourceFromJid(jid);
597
+        conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
567
     });
598
     });
568
 
599
 
569
     conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
600
     conference.rtc.addListener(RTCEvents.DOMINANTSPEAKER_CHANGED, function (id) {
582
             conference.eventEmitter.emit(JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
613
             conference.eventEmitter.emit(JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED,
583
                 lastNEndpoints, endpointsEnteringLastN);
614
                 lastNEndpoints, endpointsEnteringLastN);
584
         });
615
         });
616
+    conference.xmpp.addListener(XMPPEvents.PASSWORD_REQUIRED, function () {
617
+        conference.eventEmitter.emit(JitsiConferenceErrors.PASSWORD_REQUIRED);
618
+    });
585
 
619
 
586
     if(conference.statistics) {
620
     if(conference.statistics) {
587
         //FIXME: Maybe remove event should not be associated with the conference.
621
         //FIXME: Maybe remove event should not be associated with the conference.

+ 38
- 6
lib-jitsi-meet.js Visa fil

5
 var logger = require("jitsi-meet-logger").getLogger(__filename);
5
 var logger = require("jitsi-meet-logger").getLogger(__filename);
6
 var RTC = require("./modules/RTC/RTC");
6
 var RTC = require("./modules/RTC/RTC");
7
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
7
 var XMPPEvents = require("./service/xmpp/XMPPEvents");
8
+var AuthenticationEvents = require("./service/authentication/AuthenticationEvents");
8
 var RTCEvents = require("./service/RTC/RTCEvents");
9
 var RTCEvents = require("./service/RTC/RTCEvents");
9
 var EventEmitter = require("events");
10
 var EventEmitter = require("events");
10
 var JitsiConferenceEvents = require("./JitsiConferenceEvents");
11
 var JitsiConferenceEvents = require("./JitsiConferenceEvents");
33
     this.connection = this.options.connection;
34
     this.connection = this.options.connection;
34
     this.xmpp = this.connection.xmpp;
35
     this.xmpp = this.connection.xmpp;
35
     this.eventEmitter = new EventEmitter();
36
     this.eventEmitter = new EventEmitter();
36
-    this.room = this.xmpp.createRoom(this.options.name, null, null, this.options.config);
37
+    this.room = this.xmpp.createRoom(this.options.name, this.options.config);
37
     this.room.updateDeviceAvailability(RTC.getDeviceAvailability());
38
     this.room.updateDeviceAvailability(RTC.getDeviceAvailability());
38
     this.rtc = new RTC(this.room, options);
39
     this.rtc = new RTC(this.room, options);
39
     if(!RTC.options.disableAudioLevels)
40
     if(!RTC.options.disableAudioLevels)
43
     this.lastActiveSpeaker = null;
44
     this.lastActiveSpeaker = null;
44
     this.dtmfManager = null;
45
     this.dtmfManager = null;
45
     this.somebodySupportsDTMF = false;
46
     this.somebodySupportsDTMF = false;
47
+    this.authEnabled = false;
48
+    this.authIdentity;
46
 }
49
 }
47
 
50
 
48
 /**
51
 /**
77
     return this.options.name;
80
     return this.options.name;
78
 };
81
 };
79
 
82
 
83
+/**
84
+ * Check if authentication is enabled for this conference.
85
+ */
86
+JitsiConference.prototype.isAuthEnabled = function () {
87
+    return this.authEnabled;
88
+};
89
+
90
+/**
91
+ * Check if user is logged in.
92
+ */
93
+JitsiConference.prototype.isLoggedIn = function () {
94
+    return !!this.authIdentity;
95
+};
96
+
97
+/**
98
+ * Get authorized login.
99
+ */
100
+JitsiConference.prototype.getAuthLogin = function () {
101
+    return this.authIdentity;
102
+};
103
+
80
 /**
104
 /**
81
  * Check if external authentication is enabled for this conference.
105
  * Check if external authentication is enabled for this conference.
82
  */
106
  */
384
 
408
 
385
 JitsiConference.prototype.onMemberLeft = function (jid) {
409
 JitsiConference.prototype.onMemberLeft = function (jid) {
386
     var id = Strophe.getResourceFromJid(jid);
410
     var id = Strophe.getResourceFromJid(jid);
411
+    if (id === 'focus') {
412
+       return;
413
+    }
387
     var participant = this.participants[id];
414
     var participant = this.participants[id];
388
     delete this.participants[id];
415
     delete this.participants[id];
389
     this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id, participant);
416
     this.eventEmitter.emit(JitsiConferenceEvents.USER_LEFT, id, participant);
562
         conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
589
         conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
563
     });
590
     });
564
 
591
 
592
+    conference.room.addListener(AuthenticationEvents.IDENTITY_UPDATED, function (authEnabled, authIdentity) {
593
+        conference.authEnabled = authEnabled;
594
+        conference.authIdentity = authIdentity;
595
+    });
596
+
565
     conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
597
     conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
566
         var id = Strophe.getResourceFromJid(jid);
598
         var id = Strophe.getResourceFromJid(jid);
567
         conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
599
         conference.eventEmitter.emit(JitsiConferenceEvents.MESSAGE_RECEIVED, id, txt, ts);
612
 module.exports = JitsiConference;
644
 module.exports = JitsiConference;
613
 
645
 
614
 }).call(this,"/JitsiConference.js")
646
 }).call(this,"/JitsiConference.js")
615
-},{"./JitsiConferenceErrors":2,"./JitsiConferenceEvents":3,"./JitsiParticipant":8,"./JitsiTrackEvents":10,"./modules/DTMF/JitsiDTMFManager":11,"./modules/RTC/RTC":16,"./modules/statistics/statistics":24,"./service/RTC/RTCEvents":79,"./service/xmpp/XMPPEvents":85,"events":43,"jitsi-meet-logger":47}],2:[function(require,module,exports){
647
+},{"./JitsiConferenceErrors":2,"./JitsiConferenceEvents":3,"./JitsiParticipant":8,"./JitsiTrackEvents":10,"./modules/DTMF/JitsiDTMFManager":11,"./modules/RTC/RTC":16,"./modules/statistics/statistics":24,"./service/RTC/RTCEvents":79,"./service/authentication/AuthenticationEvents":81,"./service/xmpp/XMPPEvents":85,"events":43,"jitsi-meet-logger":47}],2:[function(require,module,exports){
616
 /**
648
 /**
617
  * Enumeration with the errors for the conference.
649
  * Enumeration with the errors for the conference.
618
  * @type {{string: string}}
650
  * @type {{string: string}}
11517
     return this._connect(jid, password);
11549
     return this._connect(jid, password);
11518
 };
11550
 };
11519
 
11551
 
11520
-XMPP.prototype.createRoom = function (roomName, options, useNicks, nick) {
11552
+XMPP.prototype.createRoom = function (roomName, options) {
11521
     var roomjid = roomName  + '@' + this.options.hosts.muc;
11553
     var roomjid = roomName  + '@' + this.options.hosts.muc;
11522
 
11554
 
11523
-    if (useNicks) {
11524
-        if (nick) {
11525
-            roomjid += '/' + nick;
11555
+    if (options.useNicks) {
11556
+        if (options.nick) {
11557
+            roomjid += '/' + options.nick;
11526
         } else {
11558
         } else {
11527
             roomjid += '/' + Strophe.getNodeFromJid(this.connection.jid);
11559
             roomjid += '/' + Strophe.getNodeFromJid(this.connection.jid);
11528
         }
11560
         }

+ 4
- 4
modules/xmpp/xmpp.js Visa fil

180
     return this._connect(jid, password);
180
     return this._connect(jid, password);
181
 };
181
 };
182
 
182
 
183
-XMPP.prototype.createRoom = function (roomName, options, useNicks, nick) {
183
+XMPP.prototype.createRoom = function (roomName, options) {
184
     var roomjid = roomName  + '@' + this.options.hosts.muc;
184
     var roomjid = roomName  + '@' + this.options.hosts.muc;
185
 
185
 
186
-    if (useNicks) {
187
-        if (nick) {
188
-            roomjid += '/' + nick;
186
+    if (options.useNicks) {
187
+        if (options.nick) {
188
+            roomjid += '/' + options.nick;
189
         } else {
189
         } else {
190
             roomjid += '/' + Strophe.getNodeFromJid(this.connection.jid);
190
             roomjid += '/' + Strophe.getNodeFromJid(this.connection.jid);
191
         }
191
         }

Laddar…
Avbryt
Spara