Bläddra i källkod

Detects whether a participant is jigasi and sets a property. (#928)

* Detects whether a participant is jigasi and sets a property.

* Fix empty param.

* Removes nested function.
dev1
Дамян Минков 6 år sedan
förälder
incheckning
8a4d1f1b08
Inget konto är kopplat till bidragsgivarens mejladress
1 ändrade filer med 27 tillägg och 6 borttagningar
  1. 27
    6
      JitsiConference.js

+ 27
- 6
JitsiConference.js Visa fil

1351
         JitsiConferenceEvents.USER_JOINED,
1351
         JitsiConferenceEvents.USER_JOINED,
1352
         id,
1352
         id,
1353
         participant);
1353
         participant);
1354
-    this.xmpp.caps.getFeatures(jid)
1355
-        .then(features => {
1356
-            participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
1357
-            this.updateDTMFSupport();
1358
-        },
1359
-        error => logger.warn(`Failed to discover features of ${jid}`, error));
1354
+
1355
+    this._updateFeatures(participant)
1356
+        .catch(() =>
1357
+
1358
+            // there was probably a mismatch, lets try one more time and give up
1359
+            this._updateFeatures(participant)
1360
+                .catch(error => {
1361
+                    logger.warn(`Failed to discover features of ${jid}`, error);
1362
+                }));
1360
 
1363
 
1361
     this._maybeStartOrStopP2P();
1364
     this._maybeStartOrStopP2P();
1362
     this._maybeSetSITimeout();
1365
     this._maybeSetSITimeout();
1364
 
1367
 
1365
 /* eslint-enable max-params */
1368
 /* eslint-enable max-params */
1366
 
1369
 
1370
+/**
1371
+ * Updates features for a participant.
1372
+ * @param {JitsiParticipant} participant - The participant to query for features.
1373
+ * @returns {Promise<Set<String> | never>}
1374
+ * @private
1375
+ */
1376
+JitsiConference.prototype._updateFeatures = function(participant) {
1377
+    return this.xmpp.caps.getFeatures(participant.getJid())
1378
+        .then(features => {
1379
+            participant._supportsDTMF = features.has('urn:xmpp:jingle:dtmf:0');
1380
+            this.updateDTMFSupport();
1381
+
1382
+            if (features.has('http://jitsi.org/protocol/jigasi')) {
1383
+                participant.setProperty('features_jigasi', true);
1384
+            }
1385
+        });
1386
+};
1387
+
1367
 /**
1388
 /**
1368
  * Get notified when member bot type had changed.
1389
  * Get notified when member bot type had changed.
1369
  * @param jid the member jid
1390
  * @param jid the member jid

Laddar…
Avbryt
Spara