Przeglądaj źródła

Selects the datachannel that is ready for sending notifications to the bridge.

master
George Politis 11 lat temu
rodzic
commit
e74d27bf88
1 zmienionych plików z 14 dodań i 6 usunięć
  1. 14
    6
      app.js

+ 14
- 6
app.js Wyświetl plik

@@ -1507,12 +1507,20 @@ $(document).bind('fatalError.jingle',
1507 1507
 function onSelectedEndpointChanged(userJid)
1508 1508
 {
1509 1509
     console.log('selected endpoint changed: ', userJid);
1510
-    if (_dataChannels && _dataChannels.length != 0 && _dataChannels[0].readyState == "open") {
1511
-        _dataChannels[0].send(JSON.stringify({
1512
-            'colibriClass': 'SelectedEndpointChangedEvent',
1513
-            'selectedEndpoint': (!userJid || userJid == null)
1514
-                ? null : Strophe.getResourceFromJid(userJid)
1515
-        }));
1510
+    if (_dataChannels && _dataChannels.length != 0)
1511
+    {
1512
+        _dataChannels.some(function (dataChannel) {
1513
+            if (dataChannel.readyState == 'open')
1514
+            {
1515
+                dataChannel.send(JSON.stringify({
1516
+                    'colibriClass': 'SelectedEndpointChangedEvent',
1517
+                    'selectedEndpoint': (!userJid || userJid == null)
1518
+                        ? null : Strophe.getResourceFromJid(userJid)
1519
+                }));
1520
+
1521
+                return true;
1522
+            }
1523
+        });
1516 1524
     }
1517 1525
 }
1518 1526
 

Ładowanie…
Anuluj
Zapisz