Quellcode durchsuchen

feat: Sends http conference-request before xmpp connecting.

release-8443
damencho vor 2 Jahren
Ursprung
Commit
6cd397fa2c
3 geänderte Dateien mit 31 neuen und 4 gelöschten Zeilen
  1. 16
    3
      JitsiConnection.js
  2. 3
    1
      modules/xmpp/ChatRoom.js
  3. 12
    0
      modules/xmpp/moderator.js

+ 16
- 3
JitsiConnection.js Datei anzeigen

@@ -54,11 +54,24 @@ export default function JitsiConnection(appID, token, options) {
54 54
 
55 55
 /**
56 56
  * Connect the client with the server.
57
- * @param options {object} connecting options
58
- * (for example authentications parameters).
57
+ * @param options {object} connecting options (for example authentications parameters).
58
+ * @param options.id {string} The username to use when connecting, if any.
59
+ * @param options.password {string} The password to use when connecting with username, if any.
60
+ * @param options.name {string} The name of the room/conference we will be connecting to. This is needed on connection
61
+ * time to be able to send conference-request over http. If missing the flow where we send conference-iq to jicofo over
62
+ * the established xmpp connection will be used, even in the case where we have configured conference http request url
63
+ * to be used.
59 64
  */
60 65
 JitsiConnection.prototype.connect = function(options = {}) {
61
-    this.xmpp.connect(options.id, options.password);
66
+    // if we get redirected, we set disableFocus to skip sending the conference request twice
67
+    if (this.xmpp.moderator.targetUrl && !this.options.disableFocus && options.name) {
68
+        this.xmpp.moderator.sendConferenceRequest(this.xmpp.getRoomJid(options.name))
69
+            .then(() => {
70
+                this.xmpp.connect(options.id, options.password);
71
+            });
72
+    } else {
73
+        this.xmpp.connect(options.id, options.password);
74
+    }
62 75
 };
63 76
 
64 77
 /**

+ 3
- 1
modules/xmpp/ChatRoom.js Datei anzeigen

@@ -227,7 +227,6 @@ export default class ChatRoom extends Listenable {
227 227
             this.options.disableFocus
228 228
                 && logger.info(`Conference focus disabled for ${this.roomjid}`);
229 229
 
230
-            // there is no point of sending conference iq when in visitor mode
231 230
             const preJoin
232 231
                 = this.options.disableFocus
233 232
                     ? Promise.resolve()
@@ -626,6 +625,9 @@ export default class ChatRoom extends Listenable {
626 625
                     this.sendPresence();
627 626
                 }
628 627
 
628
+                // we need to reset it because of breakout rooms which will reuse connection but will invite jicofo
629
+                this.xmpp.moderator.conferenceRequestSent = false;
630
+
629 631
                 this.eventEmitter.emit(XMPPEvents.MUC_JOINED);
630 632
 
631 633
                 // Now let's check the disco-info to retrieve the

+ 12
- 0
modules/xmpp/moderator.js Datei anzeigen

@@ -297,6 +297,16 @@ export default class Moderator extends Listenable {
297 297
      * rejected, and it'll keep on pinging Jicofo forever.
298 298
      */
299 299
     sendConferenceRequest(roomJid) {
300
+        // there is no point of sending conference iq when in visitor mode (disableFocus)
301
+        // when we have sent early the conference request via http
302
+        // we want to skip sending it here, or visitors can loop
303
+        if (this.conferenceRequestSent) {
304
+            return Promise.resolve();
305
+        }
306
+
307
+        // to mark whether we have already sent a conference request
308
+        this.conferenceRequestSent = false;
309
+
300 310
         return new Promise(resolve => {
301 311
             if (this.mode === 'xmpp') {
302 312
                 logger.info(`Sending conference request over XMPP to ${this.targetJid}`);
@@ -348,6 +358,8 @@ export default class Moderator extends Listenable {
348 358
                         this._handleError(roomJid);
349 359
                     });
350 360
             }
361
+        }).then(() => {
362
+            this.conferenceRequestSent = true;
351 363
         });
352 364
     }
353 365
 

Laden…
Abbrechen
Speichern